2017-08-12 115 views
1

網絡掛接設置...爲什麼消息不會被髮送?

我想響應從他們發送消息給機器人用戶的任何消息 和

我真的想用捲曲

$content = file_get_contents("php://input"); 
$update = json_decode($content, true); 

$chat_id = $update['message']['chat']['id']; 
echo $chat_id; 

$ch = curl_init(); 
$url = "https://api.telegram.org/bot" . bot_token . "/"; 
curl_setopt($ch, CURLOPT_URL, $url); 
curl_setopt($ch, CURLOPT_POST, true); 
curl_setopt($ch, CURLOPT_POSTFIELDS, "sendMessage?chat_id=" . $chat_id . "&text=hello"); 
$res = curl_exec($ch); 
curl_close($ch); 

回答

1

sendMessage是網址路徑,而不是POST正文。

URL應該是.../bot123:AA/sendMessage

相關問題