<?
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;
}
$vid = "---x4KIJVQ0";
$tal= baglanti("http://www.youtube.com/v/$vid");
preg_match("#t=(.*?)Tr#si",$tal,$tid);
$tid = $tid[1];
$val = baglanti("http://www.youtube.com/get_video?video_id=$vid&t=$tid");
preg_match("#Location: (.*?).youtube.com#si",$val,$son);
$video = $son[1].".youtube.com/get_video?video_id=".$vid;
echo $video;
?>aha bunkar çalışıyo denendi onaylandı