Skip to content

Instantly share code, notes, and snippets.

@flexgrip
Created May 9, 2012 21:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flexgrip/2649065 to your computer and use it in GitHub Desktop.
Save flexgrip/2649065 to your computer and use it in GitHub Desktop.
Grab and display videos from vimeo
<?php
/*
****** ******
************* *************
****************** ******************
******************************************
****** @ TODD's VIMEO XML SCRAPER @ ******
********************************************
********************************************
********************************************
******************************************
****************************************
**************************************
************************************
********************************
****************************
************************
********************
****************
************
********
****
**
*/
// Add your vimeo channel ID or name here
// Example: $vimeo_id = "robots"; OR $vimeo_id = "252551";
$vimeo_id = "REPLACE-ME";
// Use cURL to get Todds vimeo "web" channel xml.
$apiurl = "http://vimeo.com/api/v2/channel/".$vimeo_id."/videos.xml";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiurl);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$xml = curl_exec($ch);
curl_close($ch);
$video_data = new SimpleXMLElement($xml);
?>
<?php
// THIS will print out each row --------
foreach ($video_data->video as $vdata) {
echo $vdata->id;
echo $vdata->title;
echo $vdata->description;
echo $vdata->url;
echo $vdata->upload_date;
echo $vdata->thumbnail_small;
echo $vdata->thumbnail_medium;
echo $vdata->thumbnail_large;
echo $vdata->user_name;
echo $vdata->user_url;
echo $vdata->user_portrait_small;
echo $vdata->user_portrait_medium;
echo $vdata->user_portrait_large;
echo $vdata->user_portrait_huge;
echo $vdata->stats_number_of_likes;
echo $vdata->stats_number_of_plays;
echo $vdata->stats_number_of_comments;
echo $vdata->duration;
echo $vdata->width;
echo $vdata->height;
echo $vdata->tags;
echo $vdata->embed_privacy;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment