PHP – Get Youtube Video Title (based on supplied Video ID)


<?php
$video_id = ’48J_DIZBNyE’;
$content = file_get_contents(“http://youtube.com/get_video_info?video_id=&#8221; . $video_id);
parse_str($content, $ytarr);
echo $ytarr[‘title’] . ‘<hr>’ ; // title
?>
 
update:
you can also use this way
<?php
$video_id = ’48J_DIZBNyE’;
$video_info = simplexml_load_file(‘http://gdata.youtube.com/feeds/api/videos/&#8217;.$video_id.’?v=1′);
echo $video_info->title . ‘<hr>’; // title
echo $video_info->content; // description
?>

11 thoughts on “PHP – Get Youtube Video Title (based on supplied Video ID)

Leave a comment