如何使用telegram bot api插入用户计数时解决错误

When i send message to my bot as /addchannel @username it returns no error but the channel subscriber count was not inserted in my database

$ex = explode("/addchannel", $text);
$im = implode("", $ex);
     $content=file_get_contents("https://api.telegram.org/botxxxxx:yyyyyyyyyyy/getChatMembersCount?chat_id=".$im);
    $obj = json_decode($content, TRUE);
    $im = $obj['result'];
    bot('sendMessage',[
        'chat_id'=>$chat_id,
        'text'=>$im
      ]);
      if($text != in_array($text, $ex)){
   if($im > 1000){
        mysqli_query($db,"INSERT INTO channel(c_id,phone) VALUES('$im','0')");
        bot('sendMessage',[
            'chat_id'=>$chat_id,
            'text'=>'CHANNEL ADDED SUCCESFULLY'
          ]);
    }else{
           bot('sendMessage',[
             'chat_id'=>$chat_id,
             'text'=>'INVALID FORMAT'
           ]);
    }
}