Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 要发送的电报API编码消息_Php_Api_Urlencode_Telegram Bot - Fatal编程技术网

Php 要发送的电报API编码消息

Php 要发送的电报API编码消息,php,api,urlencode,telegram-bot,Php,Api,Urlencode,Telegram Bot,电报的编码参数url是什么?我使用了urlencode($message),但在手机上,应用程序没有解码信息**如果我没有对消息使用编码,我会得到一个错误 网关(错误501或502**,我不记得了) 示例url是我做的https://api.telegram.org/bot$token/sendMessage?chat_id=$chat_id&text=$message其中$message是我要解码的文本只需创建一个数组并使用http\u build\u query。它还为您处理编码 例如:

电报的编码参数url是什么?我使用了
urlencode($message)
,但在手机上,应用程序没有解码信息**如果我没有对消息使用编码,我会得到一个错误

网关(错误501或502**,我不记得了)


示例url是我做的
https://api.telegram.org/bot$token/sendMessage?chat_id=$chat_id&text=$message
其中
$message
是我要解码的文本

只需创建一个数组并使用
http\u build\u query
。它还为您处理编码

例如:

$queryStringArray = [
  'chat_id' => $chat_id,
  'text'    => $message,
];


$url = 'https://api.telegram.org/bot'.$token.'/sendMessage?'.http_build_query($queryStringArray);
我在我的微电报机器人应用程序中使用的正是这种方式。

Typo-http\u build\u query($queryString);不是$queryArray