curl parameter configuration in detail

The first category: For these option following optional parameters, value should be set to a value of type bool:

CURLOPT_AUTOREFERER
when according to the Location: redirect, the header automatically set the Referer: information.
CURLOPT_BINARYTRANSFER
when enabled CURLOPT_RETURNTRANSFER returns native (Raw) output.
CURLOPT_COOKIESESSION
enabled curl will only deliver a session cookie, ignore the other cookie, default status will cURL all the cookie back to the server. session session cookie means for judging that the server is valid exist cookie.
CURLOPT_CRLF
the Unix line breaks converted to a carriage return is enabled.
CURLOPT_DNS_USE_GLOBAL_CACHE
will enable a global DNS cache is enabled, this enabled as a thread-safe, and default.
CURLOPT_FAILONERROR
displays the HTTP status code, the default behavior is to ignore the number is less than equal to 400 HTTP information.
CURLOPT_FILETIME
will try to modify the information in the document when the remote is enabled. Result information is () CURLINFO_FILETIME option function returns through curl_getinfo. curl_getinfo ().
CURLOPT_FOLLOWLOCATION
When the server will enable the server returns "Location:" header in the server returns to the recursion, it can be defined recursively using CURLOPT_MAXREDIRS return number.
CURLOPT_FORBID_REUSE
forced disconnected after the completion of the interaction, it can not be reused.
CURLOPT_FRESH_CONNECT
force acquiring a new connection, instead of connecting the cache.
CURLOPT_FTP_USE_EPRT
when FTP download when using EPRT (or LPRT) command is enabled. Disable When set to FALSE EPRT and LPRT, using the PORT command only.
CURLOPT_FTP_USE_EPSV
When enabled, FTP reply in the transmission process to first try EPSV before PASV command mode. Set to disable EPSV command is FALSE.
CURLOPT_FTPAPPEND
additional write-enabled file instead of overwriting it.
CURLOPT_FTPASCII
alias CURLOPT_TRANSFERTEXT of.
CURLOPT_FTPLISTONLY
lists only the name of the FTP directory enabled.
CURLOPT_HEADER
information as header file will output data stream is enabled.
CURLINFO_HEADER_OUT
track handle the request string is enabled.
Available since PHP 5.1.3. CURLINFO_ prefix is deliberate (intentional).
CURLOPT_HTTPGET
Will be set when you enable the HTTP method is GET, since GET is the default, so only in the case of modification.
CURLOPT_HTTPPROXYTUNNEL
will be transmitted via HTTP proxy is enabled.
CURLOPT_MUTE
When you enable the cURL function all modified parameters to restore the default values.
CURLOPT_NETRC
After the connection is established, access ~ / .netrc file to obtain a user name and password information to connect remote sites.
CURLOPT_NOBODY
will not output the BODY section of the HTML is enabled.
CURLOPT_NOPROGRESS
close curl transmission progress bar when enabled, this default setting is enabled.
Note:
PHP automatically sets this option to TRUE, this option should only be changed when in debug purposes.

CURLOPT_NOSIGNAL
ignore all signals transmitted to the php curl enabled performed. This is enabled by default when SAPI multithreaded transmission.
It curls 7.10 when added.

CURLOPT_POST
sends a POST request routine enabled, type: application / x-www-form -urlencoded, like a form submission.
CURLOPT_PUT
allowed to send HTTP documents, you must also set CURLOPT_INFILE and CURLOPT_INFILESIZE enabled.
CURLOPT_RETURNTRANSFER
to the curl_exec () returns the information obtained in the form of a file stream, instead of being output.
CURLOPT_SSL_VERIFYPEER
cURL will be terminated from the server to verify the disabled. Use CURLOPT_CAINFO option to use the certificate if the certificate directory CURLOPT_CAPATH option to set CURLOPT_SSL_VERIFYPEER (2 by default) is enabled, CURLOPT_SSL_VERIFYHOST otherwise need to be set to TRUE to FALSE.
CURL 7.10 since the beginning of default is TRUE. From the beginning of the default binding install cURL 7.10.

CURLOPT_TRANSFERTEXT
use ASCII mode for FTP transmission is enabled. For LDAP, it retrieves information in plain text rather than HTML. On a Windows system, the system will not set STDOUT to binary mode.
CURLOPT_UNRESTRICTED_AUTH
in multiple locations using CURLOPT_FOLLOWLOCATION generated header in sustained additional user name and password information, even if the domain name has been changed.
CURLOPT_UPLOAD
is enabled to allow file uploads.
CURLOPT_VERBOSE
will report all information is enabled, or stored in a designated CURLOPT_STDERR in STDERR.

 

The second category: these option following optional parameter, value should be set to a value of integer type:

CURLOPT_BUFFERSIZE
data acquired in each read cache size, but does not guarantee that the value of each will be filled.
It was added in cURL 7.10.

CURLOPT_CLOSEPOLICY
not CURLCLOSEPOLICY_LEAST_RECENTLY_USED is CURLCLOSEPOLICY_OLDEST, there are three other CURLCLOSEPOLICY_, but cURL is not yet supported.
CURLOPT_CONNECTTIMEOUT
before initiating a connection waiting time, if set to 0, then wait indefinitely.
CURLOPT_CONNECTTIMEOUT_MS
attempt connection wait time, in milliseconds. If set to 0, then wait indefinitely.
CURL 7.16.2 is added in. Available since PHP 5.2.3.

CURLOPT_DNS_CACHE_TIMEOUT
provided DNS information stored in memory. The default is 120 seconds.
CURLOPT_FTPSSLAUTH
the FTP authentication: CURLFTPAUTH_SSL (first try SSL), CURLFTPAUTH_TLS (first attempt TLS) or CURLFTPAUTH_DEFAULT (cURL make automatic decisions).
CURL 7.12.2 is added in.

CURLOPT_HTTP_VERSION
CURL_HTTP_VERSION_NONE (default value, so cURL decide for themselves which version to use), CURL_HTTP_VERSION_1_0 (mandatory use of HTTP / 1.0) or CURL_HTTP_VERSION_1_1 (mandatory use of HTTP / 1.1).
CURLOPT_HTTPAUTH
the HTTP authentication method used, the optional values are: CURLAUTH_BASIC, CURLAUTH_DIGEST, CURLAUTH_GSSNEGOTIATE, CURLAUTH_NTLM , CURLAUTH_ANY and CURLAUTH_ANYSAFE.
May be used | field (or) a plurality of values separated by operators, cURL the server to select the best value of the support.
CURLAUTH_ANY equivalent to CURLAUTH_BASIC | CURLAUTH_DIGEST | CURLAUTH_GSSNEGOTIATE |. CURLAUTH_NTLM
CURLAUTH_ANYSAFE equivalent to CURLAUTH_DIGEST | CURLAUTH_GSSNEGOTIATE |. CURLAUTH_NTLM
CURLOPT_INFILESIZE
set the upload file size limit, bytes (byte) units.
CURLOPT_LOW_SPEED_LIMIT
when the transmission speed is less than CURLOPT_LOW_SPEED_LIMIT (bytes / sec), PHP based CURLOPT_LOW_SPEED_TIME slow due to determine whether to cancel the transmission.
CURLOPT_LOW_SPEED_TIME
When the transmission speed is less than CURLOPT_LOW_SPEED_LIMIT (bytes / sec), PHP based CURLOPT_LOW_SPEED_TIME slow due to determine whether to cancel the transmission.
CURLOPT_MAXCONNECTS
maximum number of allowed connections is exceeded by CURLOPT_CLOSEPOLICY will determine which connections should be stopped.
CURLOPT_MAXREDIRS
designate up to the number of HTTP redirects, and CURLOPT_FOLLOWLOCATION This option is used together.
CURLOPT_PORT
used to specify the connection port. (Optional)
CURLOPT_PROTOCOLS
CURLPROTO_ * bit field refers to. If enabled, the bit field defines which protocol values may be used during transmission has libcurl. This will allow you to support a number of protocols when you compile libcurl, but with only a subset of the restriction is allowed to use them. The default libcurl will use all of its supported protocols. See CURLOPT_REDIR_PROTOCOLS
available protocol options: CURLPROTO_HTTP, CURLPROTO_HTTPS, CURLPROTO_FTP, CURLPROTO_FTPS , CURLPROTO_SCP, CURLPROTO_SFTP, CURLPROTO_TELNET, CURLPROTO_LDAP, CURLPROTO_LDAPS, CURLPROTO_DICT, CURLPROTO_FILE, CURLPROTO_TFTP, CURLPROTO_ALL
be added in cURL 7.19.4.

CURLOPT_PROXYAUTH
HTTP proxy authentication connection. Use to set the appropriate option in the bit field of flags CURLOPT_HTTPAUTH. For proxy authentication only CURLAUTH_BASIC and CURLAUTH_NTLM currently supported.
It is added in cURL 7.10.7.

CURLOPT_PROXYPORT
port of the proxy server. Port may also be provided in CURLOPT_PROXY.
CURLOPT_PROXYTYPE
not CURLPROXY_HTTP (default value) is CURLPROXY_SOCKS5.
It was added in cURL 7.10.

CURLOPT_REDIR_PROTOCOLS
bit field value of CURLPROTO_ *. If this is enabled, the bit field value will limit the transmission protocol threads to follow a redirect when CURLOPT_FOLLOWLOCATION turn can be used. This will allow you to limit the transmission thread to redirect the use of a subset of the protocol is allowed to default libcurl will allow all protocols except for FILE and SCP. This kind of pre-release version 7.19.4 and unconditionally follow all supported protocols there are some differences. About protocol constants, please refer CURLOPT_PROTOCOLS.
CURL 7.19.4 is added in.

CURLOPT_RESUME_FROM
transfer at a byte offset resume transmission (for HTTP).
CURLOPT_SSL_VERIFYHOST
whether there is a common name (common name) 1 Check the server SSL certificate. Translator's Note: Common Name (Common Name) in general is that you will fill out to apply for SSL certificate domain name (domain) or subdomain (sub domain). 2 Check whether there is a common name, and matches the host name provided.
CURLOPT_SSLVERSION
the SSL version (2 or 3). PHP will detect this value yourself by default, although in some cases need to be manually set.
CURLOPT_TIMECONDITION
if edited in a specified time after CURLOPT_TIMEVALUE too, use CURL_TIMECOND_IFMODSINCE return to the page, if you have not been modified, and CURLOPT_HEADER is true, a "304 Not Modified" header in return, CURLOPT_HEADER false, then use CURL_TIMECOND_IFUNMODSINCE, The default value is CURL_TIMECOND_IFUNMODSINCE.
CURLOPT_TIMEOUT
set the maximum number of seconds to allow cURL performed.
CURLOPT_TIMEOUT_MS
set the maximum allowed number of milliseconds cURL performed.
CURL 7.16.2 is added in. From PHP 5.2.3 onwards can be used.

CURLOPT_TIMEVALUE
provided CURLOPT_TIMECONDITION use a timestamp used in the default state CURL_TIMECOND_IFMODSINCE.

 

The third category: these option are the following optional parameters, value should be set to a value of type string:

CURLOPT_CAINFO
a holds one or more certificates to allow the server to verify the file name. This parameter only makes sense if and CURLOPT_SSL_VERIFYPEER used together. .
CURLOPT_CAPATH
a catalog holds more CA certificates. This option is used with and CURLOPT_SSL_VERIFYPEER.
CURLOPT_COOKIE
set in the HTTP "Cookie:" portion of the requested content. Multiple cookie separated by a semicolon, the semicolon with a space (e.g., "fruit = apple; colour =
CURLOPT_COOKIEFILE
file name contains the cookie data, format cookie file can be in Netscape format, or just plain HTTP header information into the file.
CURLOPT_COOKIEJAR
save cookie information after the connection file.
CURLOPT_CUSTOMREQUEST
using a custom request message instead of "GET" or "HEAD" as an HTTP request. This request for execution "DELETE" or other, more subtle HTTP. Valid values such as "GET", "POST",and so on. In other words, do not enter here the whole HTTP request. For example, enter "GET /index.html HTTP / 1.0 \ ris incorrect.
Note:
Do not use the method to determine before the server supports the custom request.

CURLOPT_EGDSOCKET
Similarly CURLOPT_RANDOM_FILE, in addition to a Entropy Gathering Daemon socket.
CURLOPT_ENCODING
value: header "Accept-Encoding" HTTP request. Supported encoded with "identity", "deflate" and "gzip". If empty string "", the first request will be sent all supported encoding types.
It was added in cURL 7.10.

CURLOPT_FTPPORT
This value will be used to obtain the IP address for the FTP "POST" instruction required. "POST" instruction tells the remote server to connect to our specified IP address. This string may be a plain text IP address, host name, the name of a network interface (UNIX case), or just a '-' uses a default IP address.
CURLOPT_INTERFACE
network sends the name of the interface, the interface may be a name, IP address or a host name.
CURLOPT_KRB4LEVEL
krb4 (the Kerberos 4) security level. Any of the following values are valid (from low to high order): "clear", "safe ", "confidential", "private" .. If the string does not match and these will be used "private". This option is set to NULL will disable KRB4 safety certification. Currently KRB4 safety certification can only be used for FTP transfers.
CURLOPT_POSTFIELDS
All data is transmitted using the HTTP protocol "POST" operation. To send a file in front of the file name with the @ prefix and use the full path. This parameter may be similar to the string by urlencoded 'para1 = val1¶2 = val2 & ...' or to use a key field name, field data for the array values. If the value is an array, Content-Type header will be set to multipart / form-data.
CURLOPT_PROXY
HTTP proxy channel.
CURLOPT_PROXYUSERPWD
string format: one to connect to the broker "[password] [username]" .
CURLOPT_RANDOM_FILE
a filename SSL is used to generate random number seed.
CURLOPT_RANGE
as "XY", wherein X and Y are optional range acquisition data, in bytes. HTTP transport thread supports several such intermediate partition duplicates as "XY, NM" comma.
CURLOPT_REFERER
in the HTTP request header "Referer:" Content.
CURLOPT_SSL_CIPHER_LIST
list of SSL encryption algorithm. E.g. RC4-SHA and TLSv1 list encryption are available.
CURLOPT_SSLCERT
a PEM format certificate file name contains.
CURLOPT_SSLCERTPASSWD
password CURLOPT_SSLCERT certificate required.
CURLOPT_SSLCERTTYPE
type certificate. Supported formats are "PEM" (default value), "DER" and "ENG".
CURL 7.9.3 is added in.

CURLOPT_SSLENGINE
used CURLOPT_SSLKEY specified in the SSL secret key encryption engine variables.
CURLOPT_SSLENGINE_DEFAULT
used for variable asymmetric encryption operation.
CURLOPT_SSLKEY
include SSL private key file name.
CURLOPT_SSLKEYPASSWD
password specified in CURLOPT_SSLKEY in SSL private key.
Note:
Since this option contains a sensitive password information, remember to ensure the security of the PHP script.

CURLOPT_SSLKEYTYPE
private key encryption type specified CURLOPT_SSLKEY in support of key type is "PEM" (default value), "DER" and "ENG".
CURLOPT_URL
the URL of the address needs to be acquired, may be provided in curl_init () function.
CURLOPT_USERAGENT
contains a "User-Agent:" string in the HTTP request header.
CURLOPT_USERPWD
passed a connection required username and password, the format: "[username]: [password ]".

 

The fourth category: For these optional parameters option below, value should be set to an array: CURLOPT_HTTP200ALIASES 200 response code array, the array of response it is considered to be the correct response, otherwise it is considered to be wrong. CURL 7.10.3 is added in. CURLOPT_HTTPHEADER a HTTP header to set the array of fields. Array form using the following settings: Array ( 'the Content-type: text / Plain', 'the Content-length: 100') CURLOPT_POSTQUOTE the FTP requests to perform a complete set of FTP command, executing on the server. CURLOPT_QUOTE a group of FTP commands executed on the server prior to the FTP request.
 









 

Class 5: For the option of following optional parameters, value should be set to a stream resources (e.g., using the fopen ()):

CURLOPT_FILE
installation position of the output file, the value of a resource type, the default is STDOUT (browser).

CURLOPT_INFILE
file address when uploading files to be read, the value of a resource type.

CURLOPT_STDERR
set an error output address value is a resource type, instead of the default STDERR.

CURLOPT_WRITEHEADER
settings are written to the file header part of the address, the value of a resource type.

 

Sixth category: For these option are the following optional parameters, value should be set to a callback function name:

CURLOPT_HEADERFUNCTION
set up a callback function that takes two arguments, the first is the cURL resource handle, and the second is header data output. output header data must rely on this function returns the size of the data has been written.

CURLOPT_PASSWDFUNCTION
provided a callback function, three parameters, the first one is cURL resource handle, the second is a password prompt, the third parameter is the maximum password length allowed. Returns the value of the password.

CURLOPT_PROGRESSFUNCTION
provided a callback function, three parameters, the first one is cURL resource handle, the second resource is a file descriptor, the third length. Returns the data contained. CURLOPT_READFUNCTION has callback two parameters, the first parameter is a handle to a session, the second string is the HTTP response header information. Using this function, the process returns to the data itself. The return value is a data size, in bytes. 0 is returned for EOF signal. CURLOPT_WRITEFUNCTION has callback two parameters, the first parameter is a handle to a session, the second string is the HTTP response header information. This callback, the process in response to the header information itself. Header information is a response to the entire string. Set return value string length written accurate. Transmission thread terminates when an error occurs.
 




 

Guess you like

Origin www.cnblogs.com/doseoer/p/11796679.html