Eleirbag89 / TelegramBotPHP

A very simple PHP Telegram Bot API for sending messages.
http://eleirbag89.github.io/TelegramBotPHP
MIT License
807 stars 341 forks source link

How can i send video? #173

Closed Jallvar closed 4 years ago

Jallvar commented 5 years ago

Hello, how can i send video. with this library?

Eleirbag89 commented 5 years ago

For a video note:

$videonote= curl_file_create('filename.mp4','video/mp4'); // Must be on the same hosting filesystem
$content = array('chat_id' => $chat_id, 'video_note' => $videonote, 'length'=> '639'); //There was a stange bug with the lenght
$telegram->sendVideoNote($content);

For a video

$video= curl_file_create('filename.mp4','video/mp4'); // Must be on the same hosting filesystem
$content = array('chat_id' => $chat_id, 'video' => $video, 'length'=> '639'); //There was a stange bug with the lenght
$telegram->sendVideo($content);
Mohsen322 commented 5 years ago

or just you can pass a valid mp4 video url

$video= 'https://static.cdn.asset.aparat.com/avt/12161828_15s.mp4';
$content = array('chat_id' => $chat_id, 'video' => $video, 'caption' => 'TEST'); 
$telegram->sendVideo($content);