我在index.php页面中使用了以下代码
function get_model_info($model)
{
$query="select * from mobile where model_name='".$model."' limit 1";
return $query;
}
// $telegram = null;
$query=get_model_info($text);
$telegram->query=$query;
$telegram->runqury();
$result=$telegram->queryresult;
$text=urlencode($result->fetch_object()->info);
$telegram->sendmessage($userid, $text);
并在telegram.php页面上使用了以下代码
public function sendmessage($userid,$text)
{
$url='https://api.telegram.org/bot'.$this->token.'/sendmessage?chat_id='.$userid.'&text='.$text;
file_get_contents($url);
}
但它不起作用。
发布于 2017-08-04 21:58:05
使用php向电报聊天发送文本消息必须如下所示:
$url = "https://api.telegram.org/bot".$botToken."/sendMessage?chat_id=@yourtargetID&text=yourText";
file_get_contents($url);
必须用sendMessage?
(大写M)替换sendmessage?
https://stackoverflow.com/questions/44888826
复制相似问题