Phpcurl collection error 403

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.