Skip to content

Instantly share code, notes, and snippets.

@vctrfrnndz
Last active December 11, 2015 18:38
Show Gist options
  • Save vctrfrnndz/4642918 to your computer and use it in GitHub Desktop.
Save vctrfrnndz/4642918 to your computer and use it in GitHub Desktop.
Obtain a list of videos from a Vimeo account using PHP
<?php
// Account to get the videos from
$username = 'user6002596';
// Do request to Vimeo API
$request = 'http://vimeo.com/api/v2/'. $username .'/videos.xml';
// Parse into SimpleXML object
$vimeo = simplexml_load_file($request);
foreach ($vimeo->video as $video) :
$title = $video->title; // Title of the video
$videoUrl = $video->url; // URL to the video
$embedUrl = 'http://player.vimeo.com/video/'. $video->id; // URL to the embedable video
$imgUrl = $video->thumbnail_large; // Large thumbnail for the video
?>
<a href="<?= $embedUrl; ?>">
<div class="thumbnail"><img src="<?= $imgUrl; ?>" alt=""> </div>
<div class="title"><?= $title; ?></div>
</a>
<?php
endforeach;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment