为什么消息发不出去?

Why message will not be sent?

webhook 已设置...

我想向机器人用户发送消息以响应他们的任何消息 和

我真的很想用 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);

sendMessage 是 URL 路径,而不是 POST 正文。

URL 应该是 .../bot123:AA/sendMessage.