API error: uploading video from a server to Vimeo using PHP

I want to upload video from my FTP server to vimeo.

I am using the code below.

upload.php

<?php include 'vimeo.php'; $vimeo = new phpVimeo('Clientkey', 'clientsecret','accesstoken','access_token_secret'); try { $video_id = $vimeo->upload($_SERVER['DOCUMENT_ROOT'].'/my_video_path/videoname.mp4'); echo $video_id; if ($video_id) { echo '<a href="http://vimeo.com/' . $video_id . '">Upload successful!</a>'; //$vimeo->call('vimeo.videos.setPrivacy', array('privacy' => 'nobody', 'video_id' => $video_id)); $vimeo->call('vimeo.videos.setTitle', array('title' => 'YOUR TITLE', 'video_id' => $video_id)); $vimeo->call('vimeo.videos.setDescription', array('description' => 'YOUR_DESCRIPTION', 'video_id' => $video_id)); } else { echo "Video file did not exist!"; } } catch (VimeoAPIException $e) { echo "Encountered an API error -- code {$e->getCode()} - {$e->getMessage()}"; } 

vimeo.php is a PHP library taken from this link - https://github.com/vimeo/vimeo-php-lib/blob/master/vimeo.php

I do not know where access_token_secret is located.

Because of this, I ran into this problem with the name - An API error was detected - Code 401 - Invalid signature

And if I remove the access_token_secret parameter from the upload.php file

 $vimeo = new phpVimeo('Clientkey', 'clientsecret','accesstoken'); 

Then it gives me an exception: β†’ rejection is allowed .

+6
source share
2 answers

The code used and the library are deprecated (as readme mentioned in it). They are for the old, extended API.

The library you want to use is here: https://github.com/vimeo/vimeo.php Here is an example download: https://github.com/vimeo/vimeo.php/blob/master/example/upload. php

+1
source

Sign up for a Vimeo dev account in Vimeo Developers , click on "My Applications" and create a client and client key there. You do not create them yourself; Vimeo does it for you. After that, use OAuth to get the access token and secret ( Vimeo Authentication ).

+1
source

All Articles