1. Go to this page and download the library: Download lukasss93/telegrambot-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lukasss93 / telegrambot-php example snippets
use TelegramBot\TelegramBot;
$bot = new TelegramBot($token);
$update=$bot->getWebhookUpdate();
$bot->sendMessage([
'chat_id' => $update->message->chat->id,
'text' => 'Hello world!'
]);
use TelegramBot\TelegramBot;
$bot = new TelegramBot($token);
$update=$bot->getWebhookUpdate();
$text=$update->message->text;
// Load a local file to upload. If is already on Telegram's Servers just pass the resource id
$img = curl_file_create('test.png','image/png');
$bot->sendPhoto([
'chat_id' => $chat_id,
'photo' => $img
]);