PHP get final redirect url -
i final redirect url this: http://thatsthem.com/searching?ff=true&q0=rob+stott redirects this: http://thatsthem.com/search/rob-stott/325712f7
i tried answers other stackoverflow answers works other websites not above link. please help.
in case of particular site, redirection done through javascript window.location.replace()
you'll need in body of response:
$c = curl_init(); curl_setopt($c, curlopt_returntransfer, true); curl_setopt($c, curlopt_followlocation, true); curl_setopt($c, curlopt_url, "http://thatsthem.com/searching?ff=true&q0=rob+stott"); $html = curl_exec($c); $redirection_url = preg_match("/window\.location\.replace\('(.*?)'\)/", $html, $m) ? $m[1] : null; echo $redirection_url; // http://thatsthem.com/search/rob-stott/325712f7
Comments
Post a Comment