2015-09-30 89 views

回答

1

在這個特定的網站的情況下,重定向是通過JavaScript和window.location.replace()這樣做,你需要在響應的主體看:

$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