$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'http://foo.com');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_TIMEOUT, 30);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9.2) Gecko/20100115 Firefox/3.6");
$page = curl_exec($curl);
Now the site foo.com sends different redrects and I don't know what a page is inside $page variable, foo.com/bar.php or foo.com/baz.php or other. My question is how get the url of the page inside $page variable.
Thanks.