Youtube video thumbnail using php
php function to convert youtube url to video id
function getYouTubeIdFromURL($url)
{
$url_string = parse_url($url, PHP_URL_QUERY);
parse_str($url_string, $args);
return isset($args['v']) ? $args['v'] : false;
}
{
$url_string = parse_url($url, PHP_URL_QUERY);
parse_str($url_string, $args);
return isset($args['v']) ? $args['v'] : false;
}
Calling the above function
$youtube_id = getYouTubeIdFromURL("http://www.youtube.com/watch?v=4OoC8ycuCo0&feature=topvideos_sports");
echo $youtube_id."<br/>";
echo "http://img.youtube.com/vi/".$youtube_id."/0/.jpg"; */
The javascript version of the above code can be found in this blog
No comments:
Post a Comment