php 自动入款机器人,使用php在电报上创建自己的机器人

我几天前见过

this tutorial on youtube.

这非常有趣,所以我决定制作一个自己的机器人.

我使用教程中的代码作为模板:

$bottoken = "*****";

$website = "https://api.telegram.org/bot".$bottoken;

$update = file_get_contents('php://input');

$updatearray = json_decode($update, TRUE);

$length = count($updatearray["result"]);

$chatid = $updatearray["result"][$length-1]["message"]["chat"]["id"];

$text = $updatearray["result"][$length-1]["message"]["text"];

if($text == 'hy'){

file_get_contents($website."/sendmessage?chat_id=".$chatid."&text=hello");

}

elseif($text == 'ciao'){

file_get_contents($website."/sendmessage?chat_id=".$chatid."&text=bye");

}

如果我手动执行脚本,脚本会起作用.但是,当我使用webhook时,它不再起作用了.教程说$update = file_get_contents(‘php:// input’);是$update = file_get_contents($website.“/ getupdates”);之前使用的正确方法.我的问题如何使用php://输入自动执行我的脚本?该脚本位于“one.com”的服务器上,证书也来自“one.com”.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值