为什么不发送消息?

时间:2017-08-12 06:28:23

标签: api telegram telegram-bot

设置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);

0 个答案:

没有答案