<?


function baglanti($url) { 

$ch = curl_init(); 

curl_setopt($ch, CURLOPT_USERAGENT, "MSIE 6.0; Windows NT 5.0"); 

curl_setopt($ch, CURLOPT_URL, "$url" ); 

curl_setopt($ch, CURLOPT_POST, 1); 

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); 

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 

curl_setopt($ch, CURLOPT_HEADER, true); 

$sonuc = curl_exec($ch); 

curl_close($ch); 

return $sonuc; 



} 

function getir($vid) 

{ 

$tal= baglanti("http://www.youtube.com/v/".$vid); 

preg_match("#default.jpg&t=(.*)Transfer-Encoding#siU",$tal,$tid); 

$tid =trim($tid[1]); 

$val = baglanti("http://www.youtube.com/get_video?video_id=$vid&t=$tid"); 

preg_match("#http://(.*)youtube.com#siU",$val,$k); 

$vs=trim($k[1]); 

$vs=str_replace("cache.googlevideo.com/get_video?video_id=".$vid."&origin=","",$vs); 

$kral=gethostbyname($vs."youtube.com"); 

$linkim="http://".$kral."/get_video?video_id=".$vid; 


return $linkim; 

} 


 


$id="1R5N9oNruUI"; // Youtube.com Video İd

echo getir($id);
?>
Kendi Playerinizde Oynatmak İstiyorsanız

Duygusuz Coder: Youtube.com Kapandı Video Sitesi Sahiplerine Çözüm Burada