This is a simple example of telegram bot using php without any dependencies. Can work with HTTP proxy.
Your site have to use https protocol.
- Copy files on your site
- Open in browser file bot.php
- Open dialog with @BotFather (https://t.me/BotFather) in your telegram client
- Send /newbot command
- Enter your bot title
- Enter your bot name (ex: @test_bot)
- Copy token to clipboard
- Paste token to form in browser and submit form
- Edit test_bot.php, paste token and bot name
- Talk to your bot
- sendAudio() method - sends audio file with audioplayer (20Mb max)
- HTTP proxy support.
protected $commands = [
"/start" => "cmd_start",
"/help" => "cmd_help",
"/hi" => "cmd_hi"
];function cmd_hi(){
$this->api->sendMessage( "Hi, @" . $this->result["message"]["from"]["username"] . "." );
}