Php curl captures the page as follows:
$ Url = 'HTTP: // www.baidu.com '; $ ch = curl_init (); curl_setopt ($ ch, CURLOPT_URL, $ url); curl_setopt ($ ch, CURLOPT_VERBOSE, true ); curl_setopt ($ ch, CURLOPT_HEADER, true); curl_setopt ($ ch, CURLOPT_NOBODY, true); curl_setopt ($ ch, CURLOPT_CUSTOMREQUEST, 'get'); curl_setopt ($ ch, expires, true); curl_setopt ($ ch, CURLOPT_TIMEOUT, 20); curl_setopt ($ ch, CURLOPT_AUTOREFERER, true); curl_setopt ($ ch, CURLOPT_FOLLOWLOCATION, true ); $ ret = curl_exec ($ ch); $ info = curl_getinfo ($ ch); curl_close ($ ch );
If you capture the status 302, some redirects need to pass parameters to the next link during the re-capturing process, the next link also sets illegal access if the corresponding parameter is not received.
Curl_setopt ($ curl, CURLOPT_CUSTOMREQUEST, 'get ');
The display should be normal.
The above is used to capture the function, and it should be almost no problem. You can check the information about CURLOPT_CUSTOMREQUEST.
Use a custom request information instead of "GET" or "HEAD" as an HTTP request. This is applicable to the execution of "DELETE" or other more concealed HTTP requests. Valid values include "GET", "POST", and "CONNECT. That is to say, do not enter the entire HTTP request here. For example, inputting "GET/index.html HTTP/1.0 \ r \ n" is incorrect.