Last active
August 29, 2015 14:27
-
-
Save Ragnarokkr/43ba6f1f191074441ca2 to your computer and use it in GitHub Desktop.
HOWTO: Server-side access to Vimeo API with personal credentials by using official Vimeo's PHP library.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // require the library | |
| require '/path/to/vimeo.php/autoload.php'; | |
| use Vimeo\Vimeo; | |
| function getVimeoVideoData( $videoId = '' ) { | |
| // set the authentication credentials | |
| $clientId = 'client_id'; // Client ID from application's dashboard | |
| $clientSecret = 'client_secret'; // Client secret key from application's dashboard | |
| $token = 'token'; // Personal token generated from application's dashboard | |
| // make the API call... | |
| $vimeo = new Vimeo( $clientId, $clientSecret, $token ); | |
| $response = $vimeo->request( "/videos/$videoId" ); | |
| // ...and check the response | |
| if ( isset( $response[ 'body' ][ 'error' ] ) ) { | |
| // the server has responded with an error code we should to handle | |
| } else { | |
| // now we have all the available informations about the required video | |
| // and we can process them as we wish. | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment