时间:2023-02-23加入收藏
https://api.telegram.org/bot[bot_api_key]/sendMessage?chat_id=[tgid]&text=[text]
很简单吧,我想各位应该都看懂了,如果机器人没法给你发消息的话,请先给TG机器人发个消息这样才能给你发。<?php
$bot_api_key = 'CHANGE HERE';
function send_get($urlstring){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $urlstring);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
$result = curl_exec($ch);
curl_close($ch); return $result;
}
$text = @"冰豆网";
$tgid = @$_GET["tgid"];
if($text){
$url = "https://api.telegram.org/bot$bot_api_key/sendMessage?chat_id=$tgid&text=$text";
echo send_get($url);
}else{
echo "Please Input";
}
?>