How to capture the final url that a website redirects to ?
For example: http://www.facebook.com/#!/pages/Gra...15114445194693
redirects to http://www.facebook.com/pages/Gran-P...15114445194693
Using below code:
I am getting the same link not the final link.
What I am missing here ? Any response is appreciated, Thanks
For example: http://www.facebook.com/#!/pages/Gra...15114445194693
redirects to http://www.facebook.com/pages/Gran-P...15114445194693
Using below code:
I am getting the same link not the final link.
Code:
<?php $thisurl = "http://www.facebook.com/#!/pages/Gran-Piatto-dOro-Restaurant-New-York-NY/215114445194693"; $options = array( CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_ENCODING => "", CURLOPT_USERAGENT => "spider", CURLOPT_AUTOREFERER => true, CURLOPT_CONNECTTIMEOUT => 120, CURLOPT_TIMEOUT => 120, CURLOPT_MAXREDIRS => 10 ); $ch = curl_init( $thisurl ); curl_setopt_array( $ch, $options ); $content = curl_exec( $ch ); $header = curl_getinfo( $ch ); curl_close( $ch ); echo $header["url"]; ?>
Comment