Ahmed Fouad Ahmed Fouad - 1 year ago 86
PHP Question

How can I retrieve YouTube video details from video URL using PHP?

Using PHP, how can I get video information like title, description, thumbnail from a youtube video URL e.g.


Answer Source

You can get data from youtube oemebed interface in two formats: Xml and Json

Interface address: http://www.youtube.com/oembed?url=youtubeurl&format=json

Use this Php function to get data

 function get_youtube($url){

 $youtube = "http://www.youtube.com/oembed?url=". $url ."&format=json";

 $curl = curl_init($youtube);
 curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
 $return = curl_exec($curl);
 return json_decode($return, true);


$url = // youtube video url 

// Display Data 

Don't forget to Enable extension=php_curl.dll in your php.ini

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download