<?php
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
$mess = 'https://api.telegram.org/bot***BOT_TOKEN***/getUpdates';
$com = file_get_contents($mess);
$com1 = json_decode($com);
$mess1 = end($com1->result)->message->message_id;
$mess2 = $mess1;
while(true){
$com = file_get_contents($mess);
$com1 = json_decode($com);
$mess1 = end($com1->result)->message->message_id;
if($mess2 != $mess1){
//end($com1->result)->message->chat->id
$send = 'https://api.telegram.org/bot***BOT_TOKEN***/sendMessage?chat_id=' . end($com1->result)->message->chat->id . '&text=' . end($com1->result)->message->text;
file_get_contents($send);
$mess2 = $mess1;
}
}
?>
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
$mess = 'https://api.telegram.org/bot***BOT_TOKEN***/getUpdates';
$com = file_get_contents($mess);
$com1 = json_decode($com);
$mess = end($com1->result)->message;
if (is_numeric($mess->chat->id) {
$send = 'https://api.telegram.org/bot***BOT_TOKEN***/sendMessage?'
.'chat_id=' . $mess->chat->id
.'reply_to_message_id=' . $mess->id
.'&text=' . $mess->text;
file_get_contents($send);
}