Skip to content

Instantly share code, notes, and snippets.

@rantastic
Last active October 3, 2017 11:32
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rantastic/2726481 to your computer and use it in GitHub Desktop.
Save rantastic/2726481 to your computer and use it in GitHub Desktop.
PHP: Get Vimeo Thumbnail From Link
function video_image($url){
$image_url = parse_url($url);
$ch = curl_init('http://vimeo.com/api/v2/video/'.substr($image_url['path'], 1).'.php');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
$a = curl_exec($ch);
$hash = unserialize($a);
return $hash[0]["thumbnail_medium"];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment