我正在尝试为电报开发城市机器人,但遇到问题.
在向bot发送消息后,Telegram向webhook URL发送2个重复请求.
Webhook脚本工作两次,并向用户发送两次响应.
脚本 – 来自官方电报文档的hellobot.php.
服务器vps托管使用自签名SSL,上传了证书密钥到电报.
从服务器日志.
149.154.167.209 – – [28/Jun/2016:13:48:00 +0300] “POST /apps/gate.php HTTP/1.0” 200 86 “-” “-
149.154.167.209 – – [28/Jun/2016:13:48:00 +0300] “POST /apps/gate.php HTTP/1.1” 200 86 “-” “-
149.154.167.209 – – [28/Jun/2016:13:48:00 +0300] “POST /apps/gate.php HTTP/1.0” 200 86 “-” “-
149.154.167.209 – – [28/Jun/2016:13:48:00 +0300] “POST /apps/gate.php HTTP/1.1” 200 86 “-” “-
如何解决这个问题?
你能发一些代码吗?
如果您要求获取更新并在每个结果时向用户发送响应;它可能会发送重复,因为您没有设置偏移权限
offset (Description):
Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default,updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as getUpdates is called with an offset higher than its update_id. …
#getupdates_offset