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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s