Telegram Webhook Simple PHP Code

This code is the simplest code in the internet that can communicate with the telegram bot <?php if(!preg_match(‘/^149\.154\.167\.(19[7-9]|20[0-9]|21[0-9]|22[0-9]|23[0-3])$/’, $_SERVER[‘REMOTE_ADDR’])) { die(‘IP Address not allowed.’); } if($_SERVER[‘REQUEST_METHOD’] != ‘POST’) { die(‘Request method not allowed.’); } $token = ‘<bot token here>’; $rcv = file_get_contents(‘php://input’); $m = json_decode($rcv, true); print_r($m); if(isset($m[‘message’][‘text’])) { $chatid = $m[‘message’][‘chat’][‘id’]; $firstname = $m[‘message’][‘chat’][‘first_name’]; […]

Read More