2017-08-12 6 views
1

ウェブフックは、私は本当にcURLのなぜメッセージは送信されませんか?

$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を使用したい、私は彼らから と

任意のメッセージに応答して、ロボットのユーザーにメッセージを送りたい...

に設定されていますURLパス、POSTボディではありません。

URLは.../bot123:AA/sendMessageである必要があります。

関連する問題