PHP Curl Collection Tips 403 error
function Get_music_detail_url ($url) {
if (empty ($url)) return array ();
$ch = Curl_init ();
curl_setopt ($ch, Curlopt_url, $url);
curl_setopt ($ch, curlopt_returntransfer,true);
curl_setopt ($ch, Curlopt_useragent, "mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;. NET CLR 1.1.4322;. NET CLR 2.0.50727) ");
curl_setopt ($ch, Curlopt_returntransfer, 1);
curl_setopt ($ch, Curlopt_header, 0);
$somecontent = curl_exec ($ch);
Curl_close ($ch);
return $somecontent;
}
$re = $client->get_music_detail_url ("http://music.douban.com/subject/1756577/");
Print_r ($re);
Prompt for the following error
403 Forbidden
Nginx
How to solve to normal collection. You encounter a problem with prompt 403. How to collect this page
------Solution--------------------
Tested and did not find what you were saying about the phenomenon
However, there is JS control in the page data, which may not be what you need.
------Solution--------------------
The same piece of code, someone 403, someone is normal, this situation for IP (range) limit is very high probability