我在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);
}
但它不起作用。
答案 0 :(得分:0)
使用php向电报聊天发送短信必须如下:
$url = "https://api.telegram.org/bot".$botToken."/sendMessage?chat_id=@yourtargetID&text=yourText";
file_get_contents($url);
您必须将sendmessage?
替换为sendMessage?
(资本M)