ECURL_SETOPT ($ this-& gt; msh, curlopt_httpproxytunnel, true); There is no detailed explanation in the HP document, However, there is a detailed explanation in man curl. Both are proxies. proxytunnel (-p parameter) allows other protocols to be transmitted through the http proxy, while proxy (-x parameter) can only use the http protocol. So I guess that Google Baidu's server is at odds with curl's proxytunnel, so 403 is returned.
After disabling the first sentence of the above two lines of code, curl access returns to normal. In addition, it is different under several operating systems. On a MAC OSX, proxytunnel must be explicitly disabled. Curl version:
$ curl --versioncurl 7.16.3 (powerpc-apple-darwin9.0) libcurl/7.16.3 OpenSSL/0.9.7l zlib/1.2.3Protocols: tftp ftp telnet dict ldap http file https ftps Copy code The other ubuntu is not affected at all and can be used no matter what, curl version:
Protocols: tftp ftp telnet dict ldap ldaps http file https ftps Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz
Copy code centos on the MT host is fine too, curl version:
Protocols: tftp ftp telnet dict ldap http file https ftps Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz
Copy code It seems that it is not entirely a curl version problem, MAC OSX is indeed different.
There is another reason why curl will return a 403 error, if it is set:
Copy the code
and you need to follow the settings:
Otherwise, a 403 error will be returned because the http server does not allow the HEAD command. Reference: Trouble with a cURL request in PHP (http://forums.devshed.com/php-development-5/trouble-with-a-curl-request-in-php-445222.html).
The reason why curl on MAC OSX is special may be due to this reason.
|