A 403 error message is returned when phpcurl is collected. function & nbsp; get_music_detail_url ($ url) {if (empty ($ url) & nbsp; return & nbsp; array (); $ ch & nbsp; & nbsp; curl_init (); & nbsp; curl_setopt ($ ch, & nbsp; CURLOPT_URL, the error 403 is returned when php curl is collected.
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 );
The following error message is displayed:
403 Forbidden
Nginx
How can I solve the problem of normal collection. The error 403 is returned. How to collect this page
------ Solution --------------------
After testing, we did not find what you said.
However, the page data is controlled by js, and the result may not be what you need.
------ Solution --------------------
In the same code segment, there are 403 people, and some people are normal. this situation is highly likely to address IP (range) restrictions.