PHP
$apiToken = '...'
$file = 'video.mp4';
if (!file_exists($file)) {
throw new \\Exception('File not found: ' . $file);
}
$filesize = filesize($file);
$stream = fopen($file, 'r');
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => '<https://uploader.kinescope.io/video>',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_PUT => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'X-Video-Title: Video title',
'X-Video-Description: Video description',
'X-File-Name: video.mp4',
'Authorization: Bearer {$apiToken}',
],
CURLOPT_INFILE => $stream,
CURLOPT_INFILESIZE => $filesize,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1
]);
$response = curl_exec($ch);
fclose($stream);
if (curl_errno($ch)) {
$error_msg = curl_error($ch);
throw new \\Exception($error_msg);
}
curl_close($ch);
echo($response);