Bots 文件\u获取\u内容(https://api.telegram.org/bot 无法打开流:HTTP请求失败!第49行Telegrame.php中的HTTP/1.1 400错误请求

Bots 文件\u获取\u内容(https://api.telegram.org/bot 无法打开流:HTTP请求失败!第49行Telegrame.php中的HTTP/1.1 400错误请求,bots,telegram,Bots,Telegram,我在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($t

我在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);
     }

但它不起作用。

使用php向电报聊天室发送文本消息必须如下所示:

$url = "https://api.telegram.org/bot".$botToken."/sendMessage?chat_id=@yourtargetID&text=yourText";
file_get_contents($url);
您必须将
sendmessage?
替换为
sendmessage?
(大写M)