我有非常奇怪的问题,现在我解释:urlencode我有一个电报机器人用url向我发送消息,因此出于这个原因,我想添加我将粘贴在URL中的fot文本。urlencode但如果使用我有奇怪的问题。CURLOPT_POSTFIELDS要发送的消息是: This is an example my friend但如果使用和输出是:urlencodeCURLOPT_POSTFIELDS This+is+an+example+my+friend现在我显示完整的代码:$notifica= urlencode("This is an example my friend");sendMessage(xxx, $notifica);sendMessage_2($notifica);function sendMessage($chat_id, $message){ $params=[ 'chat_id' => $chat_id, 'parse_mode' => 'HTML', 'text' => $message ]; $url= 'https://api.telegram.org/botxxx'; $ch = curl_init($url); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, 3500); curl_setopt($ch, CURLOPT_TIMEOUT_MS, 3500); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $params); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $result = curl_exec($ch); curl_close($ch); }function sendMessage_2($mess){ $url= 'https://api.telegram.org/botxxx/sendMessage?chat_id=xxx&parse_mode=HTML&text='.$mess; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, 3500); curl_setopt($ch, CURLOPT_TIMEOUT_MS, 3500); $result = curl_exec($ch); curl_close($ch); }我希望有人能帮助我...非常感谢,对不起我的英语
- 2 回答
- 0 关注
- 160 浏览
添加回答
举报
0/150
提交
取消
