Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How to get body when php curl 40 1
How to get body when php curl 40 1
Phpccurl can simulate a. hk' from the server;

curl_setopt($ch,CURLOPT_TIMEOUT,200);

curl_setopt($ch,CURLOPT_HEADER,FALSE);

curl_setopt($ch,CURLOPT_NOBODY,FALSE);

# curl _ set opt($ch,CURLOPT_POSTFIELDS," username=。 $ user name. & password =. $ password);

curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE);

curl_setopt($ch,CURLOPT_FOLLOWLOCATION,FALSE);

curl_setopt($ch,CURLOPT_CUSTOMREQUEST,' GET ');

curl _ exec($ ch);

$.hk’);

curl_setopt($ch,CURLOPT_TIMEOUT,200);

curl_setopt($ch,CURLOPT_HEADER,FALSE);

curl_setopt($ch,CURLOPT_NOBODY,FALSE);

# curl _ set opt($ch,CURLOPT_POSTFIELDS," username=。 $ user name. & password =. $ password);

curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE);

curl_setopt($ch,CURLOPT_FOLLOWLOCATION,FALSE);

curl_setopt($ch,CURLOPT_CUSTOMREQUEST,' GET ');

curl _ exec($ ch);

Find the user name and password of the remote site you want to connect to in the $rc file.

CURLOPT_FOLLOWLOCATION: Set this option to a header with a non-zero value (such as "LOCATION:"), and the server will send it as part of the HTTP header (note that this is recursive, and PHP will send a header with the shape of "Location:").

CURLOPT_PUT: Set this option to a non-zero value to upload files using HTTP. To upload this file, the CURLOPT_INFILE and CURLOPT_INFILESIZE options must be set.

CURLOPT_MUTE: Set this option to a non-zero value, and PHP will be completely silent about the CURL function.

CURLOPT_TIMEOUT: Set a long integer as the maximum duration of several seconds.

CURLOPT_LOW_SPEED_LIMIT: Set a long integer to control how many bytes are transferred.

CURLOPT_LOW_SPEED_TIME: Set a long integer to control how many seconds to transfer the number of bytes specified by CURLOPT_LOW_SPEED_LIMIT.

CURLOPT_RESUME_FROM: Pass a long parameter with a byte offset address (the starting form to transfer to).

CURLOPT_SSLVERSION: Pass a long parameter containing the SSL version. The default PHP will be decided by yourself, and you have to set it manually to be more secure.

CURLOPT_TIMECONDITION: Pass a long integer parameter that specifies how to handle the CURLOPT_TIMEVALUE parameter. You can set this parameter to TIMECOND_IFMODSINCE or TIMECOND_ISUNMODSINCE. This only applies to HTTP.

CURLOPT_TIMEVALUE: the number of seconds between passing 1970- 1- 1. This time will be used as the specified value by the CURLOPT_TIMEVALUE option, or by the default TIMECOND_IFMODSINCE.

The values of the following options will be used as strings:

CURLOPT_URL: This is the URL address you want to retrieve in PHP. You can also set this option when initializing with curl_init () function.

CURLOPT_USERPWD: Pass a string in the style of [username]:[password] to connect to PHP.

CURLOPT_PROXYUSERPWD: Pass a string in the form of [username]:[password] to connect to the HTTP proxy.

CURLOPT_RANGE: Pass the range you want to specify. It should be in "X-Y" format, excluding x or y. HTTP transmission also supports several intervals, separated by segments (X-Y, N-M).

CURLOPT_POSTFIELDS: Pass a string as all the data for the HTTP“POST "operation.

Curlopt _ REFERER: A string containing the header "referer" in the HTTP request.

Curlopt _ useragent: a string containing the "user-agent" header in the HTTP request.

CURLOPT_FTPPORT: Pass a that contains the IP address used by the "FTPPORT" instruction. This POST instruction tells the remote server to connect to the IP address we specified. The string can be IP address, host name, network interface name (under UNIX) or'-'(using the system default IP address).

CURLOPT_COOKIE: Pass a header connection containing HTTP cookie.

CURLOPT_SSLCERT: pass a string containing a certificate in PEM format.

CURLOPT_SSLCERTPASSWD: Pass a password that contains the password required to use the CURLOPT_SSLCERT certificate.

CURLOPT_COOKIEFILE: passes a string containing the file name of cookie data. This cookie file can be in Netscape format or an HTTP-style header stored in the file.

CURLOPT_CUSTOMREQUEST: when making an HTTP request, pass a character to be used by GET or HEAD. In order to delete or perform other operations, it is beneficial to pass a string to be used instead of get or head when executing an http request. This is useful for making or making another more ambiguous http request. Note: Do not do this until you confirm that your server supports the command. The following options require a file description (obtained by using the fopen () function):

CURLOPT_FILE: This file will be the output file you put and transmit, and the default is STDOUT.

CURLOPT_INFILE: This file is the input file you sent.

CURLOPT_WRITEHEADER: This file contains the header of your output.

CURLOPT_STDERR: This file contains errors instead of STDERR. For example, the current practice is to log in once at a time, and those who need it will make improvements.