Reputation: 73
can any body help me to send video not in telegram bot؟
In fact, my problem is that when sending a video note is not sent in a circle. And it's sent as ordinary as sending a normal video. I followed all the necessary points are posted the video.
I uploaded the file in :
And the code I've used:
the main function :
define('API_KEY','Token');
function bot($method,$datas=[]){
$url = "https://api.telegram.org/bot".API_KEY."/".$method;
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_POSTFIELDS,http_build_query($datas));
$res = curl_exec($ch);
if(curl_error($ch)){
var_dump(curl_error($ch));
}else{
return json_decode($res);
}
};
send video note :
bot("sendVideoNote",[
"chat_id"=>$chat_id,
"video_note"=>$video_file_id,
]);
And with the place of this variable video_file_id ["file_id"], I used the direct address of the files, but I did not get any results in bot.
thanks for your helping...
Upvotes: 4
Views: 9543
Reputation: 5038
As stated in the Telegram Bot Api:
Sending video notes by a URL is currently unsupported.
This leads to video notes that are passed by an URL to be displayed as normal videos.
However, you can upload the file directly to create a real video note. Using CURLFile
it would work as following:
$path = "path/to/video.mp4";
$realpath = realpath($path);
bot("sendVideoNote",[
"chat_id" => $chat_id,
"video_note"=> new CURLFile($realpath))
]);
Upvotes: 2