Hi folks -
maybe there's a php resolution, maybe it's a perl one - I dunno... I've tried my best googling but no luck...
I'm trying to do a script that captures the URLs called during a series of http header redirects....
the best I've come up with is using php's curl_getinfo() but this only captures the number of redirects during an http request
my code:
$ch = curl_init("http://somestartingdomain.com/index.php");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); //allow redirects
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //return transfer to variable
$result = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);
print_r($info);
and the output is something like:
Array ( [url ] => http ://somefinaldomain.com.index.php/ [content_type] => text/html; charset=iso-8859-1 [http_code] => 200 [header_size] => 1245 [request_size] => 736 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 3 [total_time] => 0.216 [namelookup_time] => 0 [connect_time] => 0.032 [pretransfer_time] => 0.032 [size_upload] => 0 [size_download] => 65353 [speed_download] => 302560.18518519 [speed_upload] => 0 [download_content_length] => 292 [upload_content_length] => 0 [starttransfer_time] => 0.08 [redirect_time] => 0.006 )
In the above output, we see there were 3 redirects during the call - What I need to know is what were those URLs?????
Help much appreciated!