0

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'
           ]);
    }
}
  • Welcome on SO. Please use ```try / catch``` to get the error given :) – André DS Oct 23 '18 at 12:25
  • Can you modify this code with try / catch – user9376877 Oct 23 '18 at 12:27
  • We can't code for you :/ You need isolate the problem and debug from there. If you're stuck provide a clear explanation of what isn't working with a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). I suggest reading [How to Ask a good question](https://stackoverflow.com/help/how-to-ask). Also, be sure to [take the tour](https://stackoverflow.com/tour) – André DS Oct 23 '18 at 12:28

0 Answers0