Last active
December 11, 2015 18:38
-
-
Save vctrfrnndz/4642918 to your computer and use it in GitHub Desktop.
Obtain a list of videos from a Vimeo account using PHP
This file contains 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
<?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