S
S
seoplus20192021-06-13 00:27:14
PHP
seoplus2019, 2021-06-13 00:27:14

How to send video via file id?

Hey

function sendVideoNote($chatId){

  
global $website;	


  
$bot_url = $website.'/'; 
$url2 = $bot_url . "sendVideoNote"; 
$post_fields = array('chat_id' => $chatId, 'video_note' =>'AAMCBAADGQMAARnnbmDEy6q-2-_TnizJISOESE6pPqddAALRAgACb6gkUnLYVG5EGuIWkQHqMF0AAwEAB20AA79YAAIfBA'); 


$ch2 = curl_init(); 
curl_setopt($ch2, CURLOPT_HTTPHEADER, array( "Content-Type:multipart/form-data" )); 
curl_setopt($ch2, CURLOPT_URL, $url2); 
curl_setopt($ch2, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch2, CURLOPT_POSTFIELDS, $post_fields); 
$output = curl_exec($ch2);


$output = json_decode($output, true);
print_r($output);

}


Response

ok":false,"error_code":400,"description":"Bad Request: type of file mismatch"

Tried different file ids

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg Frolov, 2021-06-13
@Digiport

Apparently, the server does not recognize your file type and rejects it.
You need to understand the API. What files are accepted by the server (formats, extensions), are there any restrictions on the file size. Perhaps, when sending data, you need to set some headers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question