我有非常奇怪的問題,現在我解釋: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 關注
- 126 瀏覽
添加回答
舉報
0/150
提交
取消