PHP code example of rusadrako / telegram_notification

1. Go to this page and download the library: Download rusadrako/telegram_notification 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/ */

    

rusadrako / telegram_notification example snippets




use RusaDrako\telegram_notification\Bot;

$token = 'botToken'; // токен телеграм-бота
$options = [];

$tn_bot = new Bot($token, $options);

$token = 'botToken'; // токен телеграм-бота
$options = [];

$tn_bot = new RD_TG_Bot($token, $options);

$options = [
    'timeout' => 15, // время ожидания ответа от сервиса в секундах
    'marker' => 'Сервисное сообщение с test.ru: ', // маркер сообщений
];

$chat_id = 'USER_ID';
$message = 'test message';

/** @var RusaDrako\telegram_notification\Bot $tn_bot */
$tn_bot->send($chat_id, $message);

$chat_id = 'USER_ID';
$file_path = __DIR__.'/test.jpg';
$message = 'test message';

/** @var RusaDrako\telegram_notification\Bot $tn_bot */
$tn_bot->sendPhoto($chat_id, $file_path, $message);

/** @var RusaDrako\telegram_notification\Bot $tn_bot */
$tn_bot->set_token('...');

/** @var RusaDrako\telegram_notification\Bot $tn_bot */
$tn_bot->set_timeout(15);

/** @var RusaDrako\telegram_notification\Bot $tn_bot */
$tn_bot->set_marker('-->');

/** @var RusaDrako\telegram_notification\Bot $tn_bot */
$tn_bot->set_timeout(15);

use RusaDrako\telegram_notification\Bilder;

$bilder = new Bilder(Bilder);

$token = 'botToken'; // токен телеграм-бота

/** @var RusaDrako\telegram_notification\Bilder $bilder */
$tn_bot = $bilder->get($token);

/** @var RusaDrako\telegram_notification\Bilder $bilder */
$bilder->delete($tn_bot);