PHP Curl Option list (super verbose) _php tutorial

Source: Internet
Author: User
Tags ftp commands http authentication response code ftp transfer ssl certificate sub domain
First Class:
For the optional parameters of these options below, value should be set to a bool type:
Optional value values

Referer: Information is automatically set in the header when based on location: redirection.
Returns the native (raw) output when Curlopt_returntransfer is enabled.
When enabled, Curl simply passes a session cookie, ignoring other cookies, and by default, curl returns all cookies to the server. Session cookies are cookies that are used to determine if the session on the server is valid.
Converts a Unix newline character to a carriage return line break when enabled.
When enabled, a global DNS cache is enabled, which is thread-safe and enabled by default.
The HTTP status code is displayed, and the default behavior is to ignore HTTP messages with numbers less than or equal to 400.
When enabled, attempts to modify the information in the remote document. The resulting information is returned through the curlinfo_filetime option of the Curl_getinfo () function. Curl_getinfo ().
When enabled, the "location:" returned by the server server is returned to the server recursively in the header, using Curlopt_maxredirs to limit the number of recursive returns.
Forced disconnection after completion of the interaction, cannot be reused.
Forces a new connection to be taken in place of the connection in the cache.
When enabled, when FTP is downloaded, use the EPRT (or lprt) command. When set to False, disable EPRT and LPRT, using the port command only.
When enabled, the EPSV command is first attempted before replying to PASV mode during FTP transfer. When set to False, the EPSV command is disabled.
Append writes to the file instead of overwriting it when enabled.
The alias of the Curlopt_transfertext.
Only the name of the FTP directory is listed when enabled.
When enabled, the information for the header file is output as a data stream.
The request string to trace the handle when enabled.
Available starting from PHP 5.1.3. The curlinfo_ prefix is intentional (intentional).

When enabled, the method for HTTP is set to get, because get is the default, so it is used only if it is modified.
When enabled, it is transmitted over an HTTP proxy.
Restores the default values for all modified parameters in the Curl function when enabled.
After the connection is established, access the ~/.NETRC file to get the user name and password information to connect to the remote site.
When enabled, the body portion of the HTML is not output.
Turns off the progress bar of the curl transfer when enabled, and the default setting for this entry is enabled.
PHP automatically sets this option to true, and this option should only be changed for debugging purposes.

When enabled, ignores all the signals that curl passes to PHP. This entry is enabled by default when SAPI multi-threaded transmissions.
When CURL 7.10 is added.

When enabled, a regular post request is sent with the type: application/x-www-form-urlencoded, just as the form was submitted.
Allow HTTP to send files when enabled, you must set both Curlopt_infile and Curlopt_infilesize.
The information obtained by CURL_EXEC () is returned as a file stream, rather than as a direct output.
When disabled, curl terminates the validation from the server. Use the Curlopt_cainfo option to set the certificate using the Curlopt_capath option to set the certificate directory if Curlopt_ssl_verifypeer (the default value is 2) is enabled, Curlopt_ssl_ Verifyhost needs to be set to true otherwise set to False.
The default is true from Curl 7.10. The default binding installation starts with Curl 7.10.

When enabled, use ASCII mode for FTP transmissions. For LDAP, it retrieves plain text information rather than HTML. On Windows systems, the system does not set stdout to binary mode.
The user name and password information is continuously appended to multiple locations in the header generated by using curlopt_followlocation, even if the domain name has changed.
Allow file uploads when enabled.
When enabled, all information is reported and stored in the stderr or specified curlopt_stderr.

Second Category:
For the optional parameters of these options below, value should be set to an integer type:
Optional value values

The size of the cache is read in each fetch, but there is no guarantee that the value will be filled every time.
was added in Curl 7.10.

Not curlclosepolicy_least_recently_used is curlclosepolicy_oldest, there are three other curlclosepolicy_, but Curl is not supported for the time being.
The time to wait before initiating the connection, or infinite wait if set to 0.
The time, in milliseconds, to try to connect the wait. If set to 0, the wait is infinite.
Added in Curl 7.16.2. Available starting from PHP 5.2.3.

Sets the time to save DNS information in memory by default of 120 seconds.
FTP authentication method: Curlftpauth_ssl (first try SSL), Curlftpauth_tls (try TLS first) or curlftpauth_default (let curl decide automatically).
Added in Curl 7.12.2.

Curl_http_version_none (default, let CURL determine which version to use), CURL_HTTP_VERSION_1_0 (enforces http/1.0) or curl_http_version_1_1 (enforces HTTP /1.1).
The HTTP authentication methods used, the optional values are: Curlauth_basic, Curlauth_digest, Curlauth_gssnegotiate, CURLAUTH_NTLM, Curlauth_any, and Curlauth_ Anysafe.
You can use the | bit field (OR) operator to separate multiple values, and curl lets the server select one of the best supported values.
Curlauth_any equivalent to Curlauth_basic | Curlauth_digest | Curlauth_gssnegotiate | CURLAUTH_NTLM.
Curlauth_anysafe equivalent to Curlauth_digest | Curlauth_gssnegotiate | CURLAUTH_NTLM.
Sets the size limit for the upload file, in bytes (byte).
When the transfer speed is less than Curlopt_low_speed_limit (bytes/sec), PHP will determine if it is too slow to cancel the transfer, depending on the curlopt_low_speed_time.
When the transfer speed is less than Curlopt_low_speed_limit (bytes/sec), PHP will determine if it is too slow to cancel the transfer, depending on the curlopt_low_speed_time.
The maximum number of connections allowed, which is over Curlopt_closepolicy, determines which connections should be stopped.
Specify the maximum number of HTTP redirects that are used with curlopt_followlocation.
Used to specify the connection port. (option available)
The bit field of the curlproto_* refers to. If enabled, the bit-domain value qualifies libcurl for the protocols that are available for use during transmission. This will allow you to support a number of protocols when compiling libcurl, but the limit is just a subset of what is allowed in them. The default libcurl will use all of the protocols it supports. See Curlopt_redir_protocols.
The available protocol options are: 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
Added in Curl 7.19.4.

How HTTP proxy connections are validated. Use the bit field flags in Curlopt_httpauth to set the appropriate options. For proxy authentication only Curlauth_basic and CURLAUTH_NTLM are currently supported.
Added in Curl 7.10.7.

The port of the proxy server. The port can also be set in Curlopt_proxy.
Not curlproxy_http (the default) is CURLPROXY_SOCKS5.
was added in Curl 7.10.

The bit field value in the curlproto_*. If enabled, the bit-domain value restricts the protocol that the transport thread can use when Curlopt_followlocation is turned on to follow a redirect. This will enable you to restrict the transport thread to use a subset of the allowed protocols when redirecting the default Libcurl will allow all protocols except file and SCP. This and 7.19.4 pre-release versions are unconditionally followed by a number of different supported protocols. For agreement constants, refer to Curlopt_protocols.
Added in Curl 7.19.4.

Passes a byte offset (used to continue the breakpoint) when the transfer is resumed.
1 Check that there is a common name (common name) in the server SSL certificate. Note: The common name (Common name) is generally filled in with the domain name (domain) or subdomain (sub domain) where you will be applying for an SSL certificate. 2 checks if the common name exists and matches the host name provided.
The SSL version used (2 or 3). By default, PHP detects this value by itself, although in some cases it needs to be set manually.
If edited after a time specified by Curlopt_timevalue, returns a page using Curl_timecond_ifmodsince, if it has not been modified, and Curlopt_header is true, returns a 304 not Modified "header, Curlopt_header is false, the curl_timecond_ifunmodsince is used, and the default value is Curl_timecond_ifunmodsince.
Sets the maximum number of seconds that curl is allowed to execute.
Sets the maximum number of milliseconds that curl allows to execute.
Added in Curl 7.16.2. can be used from PHP 5.2.3.

Sets the timestamp used by a curlopt_timecondition, using curl_timecond_ifmodsince in the default state.

Third Category:
For the optional parameters of these options below, value should be set to a string type:
Optional value values

A file name that holds 1 or more certificates used to authenticate the server. This parameter is only meaningful when used with Curlopt_ssl_verifypeer.
A directory that holds multiple CA certificates. This option is used in conjunction with Curlopt_ssl_verifypeer.
Set the contents of the "Cookie:" section of the HTTP request. Multiple cookies are separated by semicolons, with a semicolon followed by a space (for example, "fruit=apple; Colour=red ").
The file name that contains the cookie data, the format of the cookie file can be in Netscape format, or just plain HTTP header information is stored in the file.
The file where the cookie information is saved after the connection ends.
Use a custom request message instead of "GET" or "HEAD" as an HTTP request. This is for executing "DELETE" or other more covert HTTP requests. Valid values such as "GET", "POST", "CONNECT" and so on. In other words, do not enter the entire HTTP request here. For example, entering "get/index.html http/1.0\r\n\r\n" is incorrect.
Do not use before you determine the method that the server supports for this custom request.

Similar to Curlopt_random_file, except for a entropy gathering daemon socket.
The value of "accept-encoding:" in the HTTP request header. The supported encodings are "identity", "deflate" and "gzip". If an empty string "", the request header sends all supported encoding types.
was added in Curl 7.10.

This value will be used to obtain the IP address required for the FTP "POST" instruction. The "POST" command tells the remote server to connect to the IP address we specify. This string can be a plain text IP address, host name, a network interface name (under Unix), or just a '-' to use the default IP address.
The network send interface name, which can be an interface name, an IP address, or a host name.
KRB4 (Kerberos 4) security level. Any of the following values are valid (from low to High): "Clear", "safe", "confidential", "private". If the string does not match these, "private" will be used. When this option is set to NULL, KRB4 security authentication is disabled. Currently KRB4 security authentication can only be used for FTP transmission.
All data is sent using the "POST" action in the HTTP protocol. To send a file, precede the file name with the @ prefix and use the full path. This parameter can be urlencoded after the string resembles ' para1=val1&para2=val2&amp ... ' or using a field named as the key value, the field data is an array of values. If value is an array, the Content-type header will be set to Multipart/form-data.
HTTP proxy channel.
A string that is used to connect to the agent's "[Username]:[password]" format.
A file name that is used to generate an SSL random number seed.
In the "X-y" form, where X and Y are options to get the range of data, in bytes. The HTTP transport thread also supports several such duplicates separated by commas such as "x-y,n-m".
The contents of "Referer:" in the HTTP request header.
A list of SSL encryption algorithms. For example, Rc4-sha and TLSV1 are available encrypted lists.
A file name that contains the PEM format certificate.
The password required to use the Curlopt_sslcert certificate.
The type of certificate. The supported formats are "PEM" (the default), "DER" and "ENG".
Added in Curl 7.9.3.

The cryptographic engine variable used to specify the SSL private key in Curlopt_sslkey.
A variable used for asymmetric cryptographic operations.
The file name that contains the SSL private key.
The password for the SSL private key specified in Curlopt_sslkey.
Since this option contains sensitive password information, remember to keep this PHP script secure.

The encryption type of the private key specified in Curlopt_sslkey, supported by the key type "PEM" (the default), "DER" and "ENG".
The URL address you need to get, or you can set it in the Curl_init () function.
A string that contains a "User-agent:" header in the HTTP request.
Pass in a connection the user name and password required in the format: "[Username]:[password]".

class Fourth
For the following optional parameters of option, value should be set to an array:
Optional value values

200 response Code Array, the response in the array is considered to be the correct response, otherwise it is considered to be wrong.
Added in Curl 7.10.3.

An array that is used to set the HTTP header field. The array is set using the following form: Array (' Content-type:text/plain ', ' content-length:100 ')
After the FTP request execution completes, a set of FTP commands are executed on the server.
A set of FTP commands that are executed on the server prior to FTP requests.

For the following optional parameters of option, value should be set to a stream resource (for example, using fopen ()):
Optional value values

Sets the location of the output file, the value is a resource type, and the default is stdout (browser).

The file address to be read when uploading the file, the value is a resource type.

Sets an error output address, which is a resource type that supersedes the default stderr.

Sets the file address to write the header portion of the content, and the value is a resource type.

For the following optional parameters of option, value should be set to a callback function name:
Optional value values

Set a callback function that has two parameters, the first is the resource handle for curl, and the second is the header data for the output. The output of the header data must rely on this function to return the size of the data that has been written.

Set a callback function with three parameters, the first one is the resource handle for curl, the second is a password prompt, and the third parameter is the maximum allowed for the password length. Returns the value of the password.

Set a callback function with three parameters, the first is the resource handle for curl, the second is a file descriptor resource, and the third is the length. Returns the contained data.

A callback function with two parameters, the first of which is the session handle, and the second is the string of HTTP response header information. With this function, the returned data is processed on its own. The return value is the data size, in bytes. Returns 0 represents the EOF signal.

A callback function with two parameters, the first of which is the session handle, and the second is the string of HTTP response header information. With this callback function, the response header information is processed on its own. The response header information is the entire string. Sets the return value to the exact length of the written string. The transport thread terminates when an error occurs. true techarticle First class: For the optional parameters of the following options, value should be set to a value of type bool: Optional value value Comment curlopt_autoreferer when based on location: redirect ...

  • Related Article

    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: 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.