<?php
require_once "autoload.php";
use Vimeo\Vimeo;
use Vimeo\Exceptions\VimeoUploadException;
/* AYARLAR BAŞLANGIÇ */
$config = [
'client_id' => '',
'client_secret' => '',
'access_token' => ''
];
$file_name = __DIR__."/1.mp4";
$title = 'Video Title';
$description = 'Video Description';
/* AYARLAR BİTİŞ */
$lib = new Vimeo($config['client_id'], $config['client_secret'], $config['access_token']);
echo 'Uploading: ' . $file_name . "\n";
try {
// Upload the file and include the video title and description.
$uri = $lib->upload($file_name, array(
'name' => $title,
'description' => $description
));
// Get the metadata response from the upload and log out the Vimeo.com url
$video_data = $lib->request($uri . '?fields=link');
echo '"' . $file_name . ' has been uploaded to ' . $video_data['body']['link'] . "\n";
// Make an API call to edit the title and description of the video.
$lib->request($uri, array(
'name' => $title,
'description' => $description,
), 'PATCH');
echo 'The title and description for ' . $uri . ' has been edited.' . "\n";
// Make an API call to see if the video is finished transcoding.
$video_data = $lib->request($uri . '?fields=transcode.status');
echo 'The transcode status for ' . $uri . ' is: ' . $video_data['body']['transcode']['status'] . "\n";
} catch (VimeoUploadException $e) {
// We may have had an error. We can't resolve it here necessarily, so report it to the user.
echo 'Error uploading ' . $file_name . "\n";
echo 'Server reported: ' . $e->getMessage() . "\n";
} catch (VimeoRequestException $e) {
echo 'There was an error making the request.' . "\n";
echo 'Server reported: ' . $e->getMessage() . "\n";
}
?>