The aspx page will jump. how does PHP file_get_content () perform tracking collection? Search for the keyword "39000038", www. shortname. cnSearchRefine. aspx? Keyword3921338 because there is only one, the page will automatically jump to the www. shortname. cnProductDetailMolex39-00-0038 aspx page will jump, PHP how file_get_content () for tracking collection?
Search for the keyword "39000038 」,
Http://www.mouser.cn/Search/Refine.aspx? Keyword = 39000038
Because there is only one, the page will automatically jump
Http://www.mouser.cn/ProductDetail/Molex/39-00-0038? Qs = % 2fha2pyFaduicta8SJW6uUsrinUHZLSGN9RfyeL103Gs % 3d
Search for the keyword "3900003". multiple products are a list.
Http://www.mouser.cn/Search/Refine.aspx? Keyword = 3900003
I want to know, it is directly in. net to determine and then jump, or use js to determine the jump
I want to use the file_get_content () function of php to capture
Http://www.mouser.cn/Search/Refine.aspx? Keyword = 39000038
How to track
Http://www.mouser.cn/ProductDetail/Molex/39-00-0038? Qs = % 2fha2pyFaduicta8SJW6uUsrinUHZLSGN9RfyeL103Gs % 3d
------ Solution --------------------
File_get_contents cannot do this.
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');