Last active
October 3, 2017 11:32
-
-
Save rantastic/2726481 to your computer and use it in GitHub Desktop.
PHP: Get Vimeo Thumbnail From Link
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
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