aspx頁面會跳轉,PHP如何file_get_content()進行追蹤採集?
搜尋索引鍵「39000038」,
http://www.mouser.cn/Search/Refine.aspx?Keyword=39000038
因為僅有一款,頁面會自動跳轉到
http://www.mouser.cn/ProductDetail/Molex/39-00-0038/?qs=%2fha2pyFaduicta8SJW6uUsrinUHZLSGN9RfyeL103Gs%3d
搜尋索引鍵「3900003」,有多款產品是一個列表
http://www.mouser.cn/Search/Refine.aspx?Keyword=3900003
我想知道,它是直接在.net中直接判斷然後跳轉的,還是用js判斷跳轉的
我要用php的file_get_content()函數抓取
http://www.mouser.cn/Search/Refine.aspx?Keyword=39000038
如何才能跟蹤到
http://www.mouser.cn/ProductDetail/Molex/39-00-0038/?qs=%2fha2pyFaduicta8SJW6uUsrinUHZLSGN9RfyeL103Gs%3d
------解決方案--------------------
file_get_contents 是辦不到的
function curl_get($durl) {
$t = parse_url($durl);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$durl);
curl_setopt($ch, CURLOPT_TIMEOUT,5);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_REFERER, "http://$t[host]/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$r = curl_exec($ch);
curl_close($ch);
return $r;
}
echo curl_get( 'http://www.mouser.cn/Search/Refine.aspx?Keyword=39000038');