header,1 olarak tanımla header verilerini al, orada zaten redirect diye çıkar
basit bir örnek;
<?php
function getir($url, $ref = NULL)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
$x = curl_exec($ch);
curl_close($ch);
return $x;
}
$kaynak = getir('http://adres.com/sayfa.html');
preg_match('~Location: (.*)~', $kaynak, $loc);
echo $loc[1]; // yönlendirilen adres
?>
teşekkür ederim, aradğımı buldum