Описание тега php-telegram-bot
The telegram Bots are applications that can be used via telegram chat, the interaction is via Messages. The realization of these bots with PHP simplifies the work of a developer.
It is implemented by API and HTTP-based interface has all the methods of bot telegram ( https://stackru.com/tags/telegram-bot/info).
A simple way of use is:
define('BOT_TOKEN', '<YOUR-TOKEN>');
define('API_URL', 'https://api.telegram.org/bot'.BOT_TOKEN.'/');
define('FILE_URL', 'https://api.telegram.org/file/bot'.BOT_TOKEN.'/');
$content = file_get_contents("php://input");
$update = json_decode($content, true);
$message = isset($update['message']) ? $update['message'] : "";
$chatId = isset($message['chat']['id']) ? $message['chat']['id'] : "";
$text = isset($message['text']) ? $message['text'] : "";
header("Content-Type: application/json");
$parameters = array('chat_id' => $chatId, "text" => 'you wrote: '.$text);
$parameters["method"] = "sendMessage";