GithubHelp home page GithubHelp logo

vimeo / vimeo.php Goto Github PK

View Code? Open in Web Editor NEW
447.0 52.0 209.0 772 KB

Official PHP library for the Vimeo API.

Home Page: https://developer.vimeo.com

License: Apache License 2.0

PHP 100.00%
vimeo vimeo-api

vimeo.php's Introduction

Interacting with the Vimeo API using PHP

This is a simple PHP library for interacting with the Vimeo API.

Before you start

Get started with the Vimeo API

If you’re new to Vimeo APIs, check out Getting Started: The Basics before diving into the content on this page.

Understand the PHP hierarchy

The API docs often use dot notation to represent a hierarchy of data, such as privacy.view. Since the PHP library sends all data using JSON, you must use nested associative arrays instead of dot notation.

// The documentation refers to the following as `privacy.view`
$params = ['privacy' => ['view' => 'disable']];

Install and access the PHP library

To install the PHP library, run the following command:

composer require vimeo/vimeo-api

After installation is complete, you can access the library by using $lib = new \Vimeo\Vimeo($client_id, $client_secret) in a Composer-enabled PHP script.

Advanced examples

To see examples of the most common use cases of the PHP library, visit our PHP Library Examples page.

Framework integrations

We have PHP framework integrations for WordPress and Laravel.

If you've integrated Vimeo into a popular PHP framework, let us know!

Support

To troubleshoot an issue, reach out to Vimeo Support.

vimeo.php's People

Contributors

aaronm67 avatar campbellmarc avatar craigpotter avatar dashron avatar davekiss avatar dstelljes avatar erunion avatar greedo avatar hluup avatar karlhorky avatar michalmmac avatar mstaack avatar muglug avatar muukuro avatar panchesrbovski avatar peter279k avatar qzminski avatar snapshotpl avatar sventour avatar urakozz avatar videomonkey avatar vinkla avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vimeo.php's Issues

Vimeo::uploadImage() method doesn't seem to work

I have been trying to use the uploadImage() method to add a thumbnail to a video that has been uploaded, but not yet finished processing. I'm passing in these parameters:

uploadImage("https://api.vimeo.com/videos/{$videoID}", $filename);

When I do this, I get a VimeoUploadException with message 'Unable to request an upload url from vimeo'.

I looked a bit further by debuglogging the $pictures_response variable (which is set on line 356 of Vimeo.php) and got this:

[2014-09-05 12:26:01] local.DEBUG: Array
(
    [body] => 
    [status] => 0
    [headers] => Array
        (
        )

)

Is this a bug, or am I doing something wrong?

Also is uploadImage intended to be used to upload video thumbnails? Is this expected to work for videos that have not yet finished processing?

Thanks!

Matt

Add GitHub Service Hook

Enabling the Packagist service hook ensures that your package will always be updated instantly when you push to GitHub. To do so you can go to your GitHub repository, click the "Settings" button, then "Webhooks & Services". Add a "Packagist" service, and configure it with your API token (see above), plus your Packagist username. Check the "Active" box and submit the form. You can then hit the "Test Service" button to trigger it and check if Packagist removes the warning about the package not being auto-updated.

Read more at: https://packagist.org/profile

'ErrorException' with message 'Undefined index: Range'

I get an error when trying to upload a file. The error occurs on line 406 of Vimeo.php.
After some debugging I found out that it is because there simply are no headers. The status code is 100, suggesting that the file is not completely transferred, but I am not able to find out how much was actually transferred.

There is not body either.

The quota is being checked and there is still more than enough space to transfer the video.

CURLOPT_SSL_VERIFYPEER error

Hi,
I have change CURLOPT_SSL_VERIFYPEER value to false . And is there any changes need to do value of CURLOPT_SSL_VERIFYHOST from 2 ????

Readme.md is outdated

Correctme if I am wrong but shouldnt this
// usable access token
var_dump($token->body->access_token);

// accepted scopes
var_dump($token->body->scope);

// use the token
$lib->setToken($token->body->access_token)

changed to
// usable access token
var_dump($token['body']['access_token']);

// accepted scopes
var_dump($token['body']['scope']);

// use the token
$lib->setToken($token['body']['access_token'])

Reflecting arrays not objects?

SSL certificate problem: unable to get local issuer certificate

After updating from 1.1.0 to 1.2.2 the following error occured in my development environment (Windows).

Unable to complete request.[SSL certificate problem: unable to get local issuer certificate]

On the production environment (Debian) everything was fine. So I was wondering what the problem is until I read this: http://stackoverflow.com/a/29115499/2265842.

Applied to the problem as outlined above I looks like the provided certificate vimeo-api.pem isn't even used on Debian. And on Windows (which has no default certificates) vimeo-api.pem is used, but without success. My conclusion is that the provided certificate vimeo-api.pem is incorrect and/or incomplete (and maybe not necessary?).

Finally I was thinking about how to fix that problem. First I commented out the line

CURLOPT_CAINFO => realpath(__DIR__ .'/../..') . self::CERTIFICATE_PATH

in Vimeo\Vimeo.php. Secondly I set the php.ini option curl.cainfo on my Windows environment using cacert.pem downloaded from http://curl.haxx.se/ca/cacert.pem. And finally it's working on Windows, too.

So either vimeo-api.pem must be fixed or CURLOPT_CAINFO should not be set and the system must provide the certificates.

Standardize on array or std obj

The body is returned as an std obj, but the body, headers, status etc. data is an array. We need to pick one or the other

Can't call Vimeo API

I can't get private video by calling API. It always return as below
array(3) { ["body"]=> NULL ["status"]=> int(0) ["headers"]=> array(0) { } }

I already created my app with Client Identifier, Client Secret and Personal access token. I used a code as below
$vimeo = new Vimeo($this->config->item('vimeo_client_id'),
$this->config->item('vimeo_client_secret'),
$this->config->item('vimeo_access_token'));
$video_id = '106546459';
$video = $vimeo->request("/videos/$video_id");
var_dump($video);

Please tell me what I need to do to run this API.
Thank you.

10.000 Downloads!

Just wanted to say well done! The Vimeo package has been downloaded over 10000 times.
The Laravel wrapper has been downloaded over 1000 times.

nice

Add first release

As soon as the composer (#6) pull request gets merged we should add a first release like 1.0. This will help users of this package to specify which state to fetch the package in. Instead of requiring dev-master, which pulls the latest from the master branch, developers will be a lot happier if they can fetch a stable version that they know works.

Read more about creating releases on GitHub.

Create a New Release

Maybe its time to create a new release? There has been 24 commits to master since the latest release.

Upload using URL

Hi , Can i just edit the vimeo lib and change the line no. 314 in Vimeo.php library file from "type:streaming" to "type:pull" and upload it using URL.

Can i edit that ?

Issue with PUT /videos/+clip_id/tags

It appears to be broken on both the server side and in this library. The server side seems to expect that the Content-Type header will be set to "application/json", and that a json encoded string will be sent as the body of the request. Neither of these conditions are currently possible with this library, but even if the request is sent like that.. it will still fail.

Can you verify that it's even possible to send any request currently that will add tags to a video? If so can you give me details about what currently works.

Cant get the file replace request to work

I cant seem to get the video file replace (/videos/{video_id}/files) feature to return data. eg

$vimeo_data = $vimeo->request($video_uri . '/files', array('type' => 'POST', 'redirect_url' => $redirect_target, 'upgrade_to_1080' => 'true'), 'PUT');

This hangs the page for a while then the data returned is all empty. Whereas if i put all the same parameters into the 'playground' works fine -
https://developer.vimeo.com/api/playground/videos/%7Bvideo_id%7D/files

Add StyleCI Support

This is the guide to add StyleCI support:

  1. Sign up at https://styleci.io/

  2. Go to the repositories page https://styleci.io/account#repos

  3. Enable this repository.

  4. Press Show Analysis and then Settings.

  5. Add the following settings:

    enabled:
      - unalign_double_arrow
    
    disabled:
      - psr0
      - align_double_arrow
      - phpdoc_align
  6. Press Save Configuration.

  7. Press Analyze Now.

This has to be done by the owner of the repository.

Previously brought up in #63.

Using the library to update meta data

Hi -

You mention in the readme that you are able to set meta data using the library but I've so far been unsuccessful and I was hoping for some guidance. At the moment I'm uploading the video successfully, I then call this function to try and setTitle:

$lib->request('/api/rest/v2', array('method'=>'vimeo.videos.setTitle', 'title' => $post_title, 'video_id' => $video_id ) );

But get a 'Page was not found' in return.

Any help?

Thanks in advance,
Helen

example/index.php not work

Hi, this is my first post.

I'm trying test the example index.php with my config.json configured ( my client_id, my client_secret, and without the access_token).

But when this example requests the information about the user "$user = $lib->request('/users/dashron');" the result is "Array ([body] => [status]=>0 [headers]=>Array ())".

I don't understand why the example does not work?

Thanks.

I can't upload a video through localhost

1)Can I make such request through localhost (for development purpose) ?If yes , how
2)Do I need ssl certificate on development server to make such requests ?

The exception thrown is "Server reported: Unable to get an upload ticket."

Access Token for Application requests

The documentation mentions the following:

"This response will contain the token you can add into this handle with $vimeo->setAccessToken($token_from_response). The token should be stored for later use, and you can save time in future runs by using it and skipping the request step"

Yet the setAccessToken() method hasn't been implemented. - The proper method to use is setToken()

Uploading video through SSL

Trying to upload a video that sits on the web server to Vimeo and I'm getting the following error:

A valid user token must be passed. Status code: 401

I'm using Laravel 4.2 with
"vinkla/vimeo": "~1.0" and Vimeo PHP Api version=3.2 (vimeo.php 1.0;)

The config file has the correct keys used to upload.

Uploading from localhost works perfectly.

The recommended fix from this website: http://unitstep.net/blog/2009/05/05/using-curl-in-php-to-access-https-ssltls-protected-sites/ have been implemented but still getting the same error.

Currently my Vimeo.php file have these fixes implemented: https://github.com/dstelljes/vimeo.php/commit/babb5da75a65e56717c55f1f287acbc2583292e0

I'm still getting the same error. "A valid user token must be passed"

Are there any other changes I need to implement to get this working?

typo in example

Just ran into a strange bug once I got it working with access_token and all.. it was showing some strange user named 'Scott' and all of their info... turns out there was a type on line 32 in the /example/index.php:

$user = $lib->request('/users/me');
should be:
$user = $lib->request('/me');

Otherwise Scott (username 'me') will be getting lots of attention....

DELETE ticket needs video_id and signature

It seems DELETE needs a video_id and a signature.

But these are not being set when calling the endpoint with DELETE.

The documentation is however now at all clear what these are, neither video_id or signature are clear so I can't get it to work...

Method clientCredentials always return status 0 and empty token

In my tests i could not get the credentials, my response was always a array with status = 0 and empty token, it only worked when i added the "Content-Type: application/x-www-form-urlencoded" if "$json_body" was false, wich was the case of the "clientCredentials" method.

Is there anything i missed? client_id and secret are ok, and my authorization header also ok.

If not would be good to have the header added to the next release.

Best regards.

Changing name/description via PATCH /videos/+clip_id

Before sending the information out, the library uses http_build_query resulting in a change from something like..

"This is the title"
to
"This+is+the+title"

Those characters aren't getting decoded on the server side. URLencoding the data beforehand doesn't work either.

Tags with spaces

Hi,

It looks like there is no way to add a tag with spaces using the library.

Both:

$newTag = 'Test Tag';
$response = $lib->request('/videos/'.$videoId.'/tags', array('tag' => $newTag), 'PUT');

And:

$newTag = 'Test Tag';
$response = $lib->request('/videos/'.$videoId.'/tags/'.$newTag, array(), 'PUT');

Do not work. In both cases the video is tagged with the word "Test".
I am not sure if this is an issue of the library or the API.

Standardize request parameters across all api libs

Nested request bodies exist in the api, and are not consistently supported across the api libraries.

We need to always take nested arrays

array('privacy' => array ('view' => 'nobody') )

and if using querystring request format, expand them

"privacy.view=nobody"

I can not get Video details

hi,

Hope you are doing great.I am using your pkg for vimeo integration.When i am using
$result = Vimeo::request('/me/videos', ['per_page' => 10], 'GET'); )
this method it is giving
{"error":"A valid user token must be passed."}
this error.
Can you tell me whats i am doing wrong.

Upload function broken

It seems to have been broken because this commit removed the following line from the "perform_upload" function:

$upload_response = $this->_request($url, $curl_opts);   //  Send what we can.

When I manually added this line back in my uploads started working.

Unable to complete request

I am trying to set-up the Vimeo API for PHP and I am receiving the error below. Is there a checklist to confirm required steps and files? Please help!

Fatal error: Uncaught exception 'Vimeo\Exceptions\VimeoRequestException' with message 'Unable to complete request.[Problem with the SSL CA cert (path? access rights?)]' in /home3/iwright/public_html/church/src/Vimeo/Vimeo.php:154 Stack trace: #0 /home3/iwright/public_html/church/src/Vimeo/Vimeo.php(127): Vimeo\Vimeo->_request('https://api.vim...', Array) #1 /home3/iwright/public_html/church/indexVimeo.php(27): Vimeo\Vimeo->request('/me') #2 {main} thrown in /home3/iwright/public_html/church/src/Vimeo/Vimeo.php on line 154

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.