PHP Curl Options list (Ultra detail) _php tips

Source: Internet
Author: User
Tags curl curl options ftp commands http authentication php script ftp transfer ssl certificate sub domain

First Category:
For the optional Arguments for option below, value should be set to a value of type bool:
Options
Optional value value
Note

Curlopt_autoreferer
Automatically sets the Referer: information in the header when redirected according to location: redirect.
Curlopt_binarytransfer
Returns the native (raw) output when Curlopt_returntransfer is enabled.
curlopt_cookiesession
When enabled, Curl will simply pass a session cookie, ignoring the other cookies, and curl will return all cookies to the server by default. A session cookie is a cookie that is used to determine whether a server-side session is valid.
Curlopt_crlf
When enabled, converts a newline character from UNIX to a carriage return line feed.
Curlopt_dns_use_global_cache
When enabled, a global DNS cache is enabled, which is thread-safe and is enabled by default.
Curlopt_failonerror
Displays the HTTP status code, and the default behavior is to ignore HTTP information with a number less than or equal to 400.
Curlopt_filetime
When enabled, an attempt is to modify information in a remote document. The resulting information is returned through the curlinfo_filetime option of the Curl_getinfo () function. Curl_getinfo ().
curlopt_followlocation
When enabled, "Location:" returned by the server server is returned recursively to the server in the header, using Curlopt_maxredirs to limit the number of recursive returns.
Curlopt_forbid_reuse
Forced disconnect after completing the interaction, cannot be reused.
Curlopt_fresh_connect
Forces a new connection to replace the connection in the cache.
curlopt_ftp_use_eprt
When enabled, use the EPRT (or LPRT) command when FTP downloads. When set to False, disable EPRT and LPRT and use the port command only.
CURLOPT_FTP_USE_EPSV
When enabled, first try the EPSV command before reverting to PASV mode during FTP transfer. When set to False, disables the EPSV command.
Curlopt_ftpappend
Append writes to the file instead of overwriting it when enabled.
Curlopt_ftpascii
Alias for Curlopt_transfertext.
curlopt_ftplistonly
Only the name of the FTP directory is listed when enabled.
Curlopt_header
When enabled, the header file's information is exported as a data stream.
Curlinfo_header_out
The request string that tracks the handle when enabled.
Available starting from PHP 5.1.3. The curlinfo_ prefix is intentional (intentional).

Curlopt_httpget
When enabled, the method of HTTP is set to get, because get is the default, so it is only used if it is modified.
Curlopt_httpproxytunnel
When enabled, it is transmitted through the HTTP proxy.
Curlopt_mute
Restores the default values for all modified parameters in the Curl function when enabled.
CURLOPT_NETRC
After the connection is established, access the ~/.NETRC file to get the username and password information to connect to the remote site.
Curlopt_nobody
When enabled, the body portion of HTML is not output.
curlopt_noprogress
Turn off the progress bar for curl transmissions when enabled, and the default setting for this entry is enabled.
Note:
PHP automatically sets this option to true, and this option should only be changed for debugging purposes.

curlopt_nosignal
When enabled, ignores all curl passed to PHP for the signal. This entry is enabled by default when SAPI a multithreaded transmission.
CURL was added when he was 7.10.

Curlopt_post
When enabled, a regular post request is sent, with the type: application/x-www-form-urlencoded, just like the form submission.
Curlopt_put
Allows HTTP to send files when enabled, and must also set both Curlopt_infile and Curlopt_infilesize.
Curlopt_returntransfer
The information obtained by CURL_EXEC () is returned as a file stream, rather than as a direct output.
Curlopt_ssl_verifypeer
When disabled, curl will terminate validation from the server side. Setting up certificates using the CURLOPT_CAINFO option set the certificate directory with the Curlopt_capath option if Curlopt_ssl_verifypeer (the default is 2) enabled, Curlopt_ssl_ Verifyhost need to be set to true otherwise set to False.
Starting from Curl 7.10 defaults to true. Start the default binding installation from Curl 7.10.

Curlopt_transfertext
Use ASCII mode for FTP transfer when enabled. For LDAP, it retrieves plain text information rather than HTML. On Windows systems, the system does not set the STDOUT to binary mode.
Curlopt_unrestricted_auth
continues to append user name and password information in multiple locations in the header generated by using curlopt_followlocation, even if the domain name has changed.
Curlopt_upload
Allow file uploads when enabled.
Curlopt_verbose
When enabled, all information is reported and stored in stderr or designated Curlopt_stderr.

Second Category:
For the optional arguments for the option below, value should be set to an integer value:
Options
Optional value value
Note

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

Curlopt_closepolicy
Not curlclosepolicy_least_recently_used is curlclosepolicy_oldest, there are three other curlclosepolicy_, but Curl is not supported at the moment.
Curlopt_connecttimeout
The time to wait before initiating the connection, and if set to 0, wait indefinitely.
Curlopt_connecttimeout_ms
The time, in milliseconds, that the attempt to connect waits. If set to 0, wait indefinitely.
Be joined in the Curl 7.16.2. Available starting from PHP 5.2.3.

Curlopt_dns_cache_timeout
Sets the time to save DNS information in memory by default of 120 seconds.
Curlopt_ftpsslauth
FTP Authentication mode: Curlftpauth_ssl (try SSL first), Curlftpauth_tls (try TLS first) or curlftpauth_default (let curl automatically decide).
Be joined in the Curl 7.12.2.

curlopt_http_version
Curl_http_version_none (default, let CURL decide which version to use), CURL_HTTP_VERSION_1_0 (forced to use http/1.0) or curl_http_version_1_1 (force the use of HTTP /1.1).
Curlopt_httpauth
The HTTP authentication method that is 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, curl let the server select a support best value.
Curlauth_any equivalent to Curlauth_basic | Curlauth_digest | Curlauth_gssnegotiate | CURLAUTH_NTLM.
Curlauth_anysafe equivalent to Curlauth_digest | Curlauth_gssnegotiate | CURLAUTH_NTLM.
curlopt_infilesize
Sets the size limit of the upload file, in bytes (byte).
Curlopt_low_speed_limit
When the transmission speed is less than Curlopt_low_speed_limit (bytes/sec), PHP will be based on curlopt_low_speed_time to determine if the transmission is canceled because it is too slow.
Curlopt_low_speed_time
When the transmission speed is less than Curlopt_low_speed_limit (bytes/sec), PHP will be based on curlopt_low_speed_time to determine if the transmission is canceled because it is too slow.
curlopt_maxconnects
The maximum number of connections allowed, over which connections should be stopped through Curlopt_closepolicy.
Curlopt_maxredirs
Specifies the maximum number of HTTP redirects, which are used with curlopt_followlocation.
Curlopt_port
Used to specify a connection port. (optional)
Curlopt_protocols
The bit field of the curlproto_* is defined. If enabled, the Bit-field value limits the Libcurl protocols that can be used during the transfer process. This will allow you to support many protocols while compiling the Libcurl, but the restriction is only a subset of them that are allowed to be used. 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
Be joined in the Curl 7.19.4.

Curlopt_proxyauth
Authentication method for HTTP proxy connections. 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.
Be joined in the Curl 7.10.7.

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

Curlopt_redir_protocols
The bit-field value in the curlproto_*. If enabled, the bit-field value will limit the protocol that the transport thread can use when Curlopt_followlocation is turned on to follow a redirection. This will allow you to limit the transmission thread to the redirection when using the allowed subset of protocols default Libcurl will permit all protocols except file and SCP. This and 7.19.4 pre-release versions are somewhat different from unconditionally following all supported protocols. For protocol constants, refer to Curlopt_protocols.
Be joined in the Curl 7.19.4.

Curlopt_resume_from
Passes a byte offset (used for a continuation of a breakpoint) when the transfer is resumed.
Curlopt_ssl_verifyhost
1 Check that there is a common name (common name) in the server SSL certificate. The common name (Common name) is generally to fill in the domain or subdomain (sub domain) where you will apply for an SSL certificate. 2 checks to see if the common name exists and matches the supplied host name.
curlopt_sslversion
The version of SSL used (2 or 3). By default, PHP detects this value itself, although in some cases it needs to be set manually.
curlopt_timecondition
If edited after a certain time specified by Curlopt_timevalue, returns the page using Curl_timecond_ifmodsince, if it has not been modified, and Curlopt_header is true, returns a "304 not Modified, Curlopt_header is false, the curl_timecond_ifunmodsince is used, and the default value is Curl_timecond_ifunmodsince.
Curlopt_timeout
Sets the maximum number of seconds that curl allows to execute.
Curlopt_timeout_ms
Sets the maximum number of milliseconds that curl allows to execute.
Be joined in the Curl 7.16.2. Available from PHP 5.2.3.

Curlopt_timevalue
Sets the timestamp used by a curlopt_timecondition, which is curl_timecond_ifmodsince using the default state.

Category III:
For the optional arguments below, value should be set to a string type value:
Options
Optional value value
Note

Curlopt_cainfo
A file name that holds 1 or more certificates that are used to authenticate the server. This parameter is only meaningful when used with Curlopt_ssl_verifypeer.
Curlopt_capath
A directory that holds multiple CA certificates. This option is used in conjunction with Curlopt_ssl_verifypeer.
Curlopt_cookie
Sets the contents of the "Cookie:" section of the HTTP request. Multiple cookies are separated by semicolons with a single space (for example, "fruit=apple;"). Colour=red ").
Curlopt_cookiefile
The file name containing the cookie data, the format of the cookie file can be in Netscape format, or only the pure HTTP header information is saved to the file.
Curlopt_cookiejar
A file that stores cookie information after the connection is completed.
Curlopt_customrequest
Use a custom request information instead of "get" or "head" as an HTTP request. This is done for "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, the input "get/index.html http/1.0\r\n\r\n" is not correct.
Note:
Do not use before determining the method that the server supports this custom request.


Curlopt_egdsocket
Similar to Curlopt_random_file, except for a entropy gathering daemon socket.
curlopt_encoding
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 to the Curl 7.10.

Curlopt_ftpport
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.
Curlopt_interface
The network send interface name, which can be an interface name, an IP address, or a host name.
Curlopt_krb4level
KRB4 (Kerberos 4) security level. Any of the following values are valid (from lowest to highest order): Clear, safe, confidential, private. If the string does not match these, "private" will be used. KRB4 Security Authentication is disabled when this option is set to NULL. At present, KRB4 security authentication can only be used for FTP transmission.
Curlopt_postfields
All data is sent using the "POST" action in the HTTP protocol. To send a file, precede the filename with the @ prefix and use the full path. This parameter can be passed a urlencoded string similar to ' Para1=val1&para2=val2&amp ... ' or an array with the field data as a value with the field name as the key value. If value is an array, the Content-type header will be set to Multipart/form-data.
Curlopt_proxy
HTTP proxy channel.
curlopt_proxyuserpwd
A string that is used to connect to the agent's [Username]:[password] format.
Curlopt_random_file
A file name that is used to generate an SSL random number seed.
Curlopt_range
In the form of "XY", where X and Y are all options to get the data in bytes. The HTTP transport thread also supports several such duplicates, separated by commas such as "x-y,n-m".
Curlopt_referer
The contents of "Referer:" in the HTTP request header.
curlopt_ssl_cipher_list
A list of SSL encryption algorithms. For example, Rc4-sha and TLSV1 are all available encryption lists.
Curlopt_sslcert
A file name containing the PEM format certificate.
curlopt_sslcertpasswd
The password required to use the Curlopt_sslcert certificate.
Curlopt_sslcerttype
The type of certificate. The supported formats are "PEM" (default), "DER" and "ENG".
Be joined in the Curl 7.9.3.

Curlopt_sslengine
The cryptographic engine variable used to specify the SSL private key in Curlopt_sslkey.
Curlopt_sslengine_default
A variable used to do an asymmetric cryptographic operation.
Curlopt_sslkey
The name of the file that contains the SSL private key.
curlopt_sslkeypasswd
The password for the SSL private key specified in Curlopt_sslkey.
Note:
Because this option contains sensitive password information, remember to keep this PHP script secure.

Curlopt_sslkeytype
The encryption type of the private key specified in Curlopt_sslkey, the supported key types are "PEM" (default), "DER", and "ENG".
Curlopt_url
The URL address that needs to be obtained, or can be set in the Curl_init () function.
curlopt_useragent
Contains a string of "user-agent:" headers in the HTTP request.
curlopt_userpwd
Pass the username and password required in a connection in the form: [Username]:[password].


Fourth Class
For the optional arguments for the option below, value should be set to an array:
Options
Optional value value
Note

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

Curlopt_httpheader
An array to set the HTTP header fields. Set using an array of the following forms: Array (' Content-type:text/plain ', ' content-length:100 ')
Curlopt_postquote
A set of FTP commands that are executed on the server after the execution of the FTP request completes.
Curlopt_quote
A set of FTP commands that are executed on the server prior to the FTP request.

For the optional arguments below, value should be set to a stream resource (for example, using fopen ()):
Options
Optional value value

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

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

Curlopt_stderr
Sets an error output address, and the value is a resource type that replaces the default stderr.

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

For the optional arguments below, value should be set to a callback function name:
Options
Optional value value

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

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

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

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

curlopt_writefunction
A callback function with two parameters, the first is a session handle, and the second is a string of HTTP response header information. Using 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.

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: info-contact@alibabacloud.com 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.