1. Go to this page and download the library: Download smoqadam/php-telegram-bot 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/ */
smoqadam / php-telegram-bot example snippets
moqadam\Telegram;
$tg = new Telegram('API_TOKEN');
$tg->cmd('\/name:<<[a-zA-Z]{0,}>>', function ($args) use ($tg){
$tg->sendMessage("my username is @".$args , $tg->getChatId());
});
$tg->cmd('\/number: <<:num>>' , function($args) use($tg){
$tg->sendMessage("your number is : ".$args , $tg->getChatId());
});
$tg->cmd('Hello',function () use ($tg){
$tg->sendChatAction(Telegram::ACTION_TYPING);
$image = 'urltoqrcode.png';
$tg->sendPhoto($image);
});
$tg->run();
sage = file_get_contents('php://input');
use Smoqadam\Telegram;
$tg = new Telegram('API_TOKEN');
$tg->cmd('\/name:<<[a-zA-Z]{0,}>>', function ($args) use ($tg){
$tg->sendMessage("my username is @".$args , $tg->getChatId());
});
$tg->cmd('\/number: <<:num>>' , function($args) use($tg){
$tg->sendMessage("your number is : ".$args , $tg->getChatId());
});
$tg->cmd('Hello',function () use ($tg){
$tg->sendChatAction(Telegram::ACTION_TYPING);
$image = 'urltoqrcode.png';
$tg->sendPhoto($image);
});
$tg->process(json_decode($message, true));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.