Skip to content

Instantly share code, notes, and snippets.

@Ragnarokkr
Last active August 29, 2015 14:27
Show Gist options
  • Select an option

  • Save Ragnarokkr/43ba6f1f191074441ca2 to your computer and use it in GitHub Desktop.

Select an option

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.
// 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