Youtube video adresi ile video, resim ve başlık çekmek

Youtube adresini $url değişkenine yazarak ilgili verilere ulaşabilirsiniz. Alttaki istediğiniz değişkenleri echo ile yazdırabilirsiniz.

<?php header('Content-Type: text/html; charset=utf-8');
$url="http://www.youtube.com/watch?v=E2tMV96xULk";//istediğiniz urlyi yazınız
 
//ID AYIRMA
parse_str( parse_url( $url, PHP_URL_QUERY ), $videodizi );
$xml=simplexml_load_file("http://gdata.youtube.com/feeds/api/videos/".$videodizi['v']."?v=2");
 
//İSTEDİĞİNİZİ BAŞINA ECHO KOYUP KULLANABİLİRSİNİZ
$kucukvideoplayer='<iframe width="480" height="360" src="http://www.youtube.com/embed/'.$videodizi['v'].'?enablejsapi=1&autoplay=0&cc_load_policy=0&iv_load_policy=1&loop=0&modestbranding=0&rel=1&showinfo=1&autohide=2&theme=dark&color=red&wmode=opaque&vq=&controls=2&" frameborder="0" type="text/html" allowfullscreen="" webkitallowfullscreen="" mozallowfullscreen=""></iframe>';
$buyukboyresim='<img src="http://img.youtube.com/vi/'.$videodizi['v'].'/hqdefault.jpg" alt="'.$xml->title.'" width="480" height="360">';
$ortaboyresim='<img src="http://img.youtube.com/vi/'.$videodizi['v'].'/mqdefault.jpg" alt="'.$xml->title.'" width="320" height="180">';
$kucukboyresim='<img src="http://img.youtube.com/vi/'.$videodizi['v'].'/default.jpg" alt="'.$xml->title.'" width="120" height="90">';
 
$youtubevideolink='<a href="'.$xml->link['0']['href'].'" title="'.$xml->title.'">'.$xml->title.'</a>';
$videobaslik=$xml->title;
$tamekranvideo='<iframe src="'.$xml->content['src'].'" height="100%" width="100%" frameborder="0">Your browser doesnot support iframes <a href="'.$xml->link['0']['href'].'" alt="'.$xml->title.'">'.$xml->title.'</a>click here to view the page directly. </a></iframe>';
//tamekran videoda body{margin:0;padding:0} css eklemeyi unutmayınız. ulusanyazilim@gmail.com #ulusanyazilim @ulusanyazilim
?>
 */

 

Sizin Değerli Görüşlerinize İhtiyacımız Var.