PHP实现Telegram消息自动发送功能详解
作者:纸飞机下载 | 发布时间:2025-09-24 19:47
$botToken = 'YOUR_BOT_TOKEN';
$chatId = 'TARGET_CHAT_ID';
$message = 'Hello from PHP!';
$url = "
$data = [
'chat_id' => $chatId,
'text' => $message
];
$options = [
'http' => [
'method' => 'POST',
'header' => "Content-Type:application/x-www-form-urlencodedr
'content' => http_build_query($data)
];
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
echo $result ? '消息发送成功' : '发送失败';
?>
本文章来自(http://www.iottech.com.cn),转载请说明出处!
下一篇:没有了