iDeveloper
iDeveloper

Reputation: 627

API error : Upload Video from server to Vimeo using PHP

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

I am using below code.

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 don't know where is access_token_secret is located.

Because of this I am facing this issue named - Encountered an API error -- code 401 - Invalid signature

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

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

Then it is giving me exception :-> permission denied.

Upvotes: 3

Views: 4478

Answers (2)

Dashron
Dashron

Reputation: 3998

The code and library you are using are out of date (as mentioned in it's readme). They are for the old, advanced API.

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

Upvotes: 2

Josh Grosso
Josh Grosso

Reputation: 2124

Sign up for a Vimeo dev account at Vimeo Developers, click on "My Apps", and create get your client key and client secret from there. You don't create those on your own; Vimeo does it for you. After that, use OAuth to obtain an access token and secret (Vimeo Authentication).

Upvotes: 1

Related Questions