Php 要发送的电报API编码消息
电报的编码参数url是什么?我使用了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。它还为您处理编码 例如:
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