How to solve this problem when i try to insert data to database using telegram bot api

If i send /addchannel @channelusername to bot it dosent inserting channel username to my database .See below code.And help me to solve this

$ex = explode("/addchannel", $text);
$im = implode(" ", $ex);
if($text != in_array($text, $ex)){
	  $content=file_get_contents("https://api.telegram.org/bot729696Sunlq5-Xzl0SQ5wyQ34XtRawopfU/getChatMembersCount?chat_id=".$text);
    $obj = json_decode($content, TRUE);
    $subs = $obj['result'];
    bot('sendMessage',[
        'chat_id'=>$chat_id,
        'text'=>$subs
      ]);
    if($subs > 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'
           ]);
    }
}

Telegram bot is prohibited on free plan.