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:
Options
Optional value values
Note

Curlopt_autoreferer
Referer: Information is automatically set in the header when based on location: redirection.
Curlopt_binarytransfer
Returns the native (raw) output when Curlopt_returntransfer is enabled.
curlopt_cookiesession
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.
Curlopt_crlf
Converts a Unix newline character to a carriage return line break when enabled.
Curlopt_dns_use_global_cache
When enabled, a global DNS cache is enabled, which is thread-safe and enabled by default.
Curlopt_failonerror
The HTTP status code is displayed, and the default behavior is to ignore HTTP messages with numbers less than or equal to 400.
Curlopt_filetime
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 ().
curlopt_followlocation
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.
Curlopt_forbid_reuse
Forced disconnection after completion of the interaction, cannot be reused.
Curlopt_fresh_connect
Forces a new connection to be taken in place of the connection in the cache.
curlopt_ftp_use_eprt
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.
CURLOPT_FTP_USE_EPSV
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.
Curlopt_ftpappend
Append writes to the file instead of overwriting it when enabled.
Curlopt_ftpascii
The alias of the Curlopt_transfertext.
curlopt_ftplistonly
Only the name of the FTP directory is listed when enabled.
Curlopt_header
When enabled, the information for the header file is output as a data stream.
Curlinfo_header_out
The request string to trace the handle when enabled.
Available starting from PHP 5.1.3. The curlinfo_ prefix is intentional (intentional).

Curlopt_httpget
When enabled, the method for HTTP is set to get, because get is the default, so it is used only if it is modified.
Curlopt_httpproxytunnel
When enabled, it is transmitted over an 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 user name and password information to connect to the remote site.
Curlopt_nobody
When enabled, the body portion of the HTML is not output.
curlopt_noprogress
Turns off the progress bar of the curl transfer 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 the signals that curl passes to PHP. This entry is enabled by default when SAPI multi-threaded transmissions.
When CURL 7.10 is added.

Curlopt_post
When enabled, a regular post request is sent with the type: application/x-www-form-urlencoded, just as the form was submitted.
Curlopt_put
Allow HTTP to send files when enabled, you must 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 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.

Curlopt_transfertext
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.
Curlopt_unrestricted_auth
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.
Curlopt_upload
Allow file uploads when enabled.
Curlopt_verbose
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:
Options
Optional value values
Note

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

Curlopt_closepolicy
Not curlclosepolicy_least_recently_used is curlclosepolicy_oldest, there are three other curlclosepolicy_, but Curl is not supported for the time being.
Curlopt_connecttimeout
The time to wait before initiating the connection, or infinite wait if set to 0.
Curlopt_connecttimeout_ms
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.

Curlopt_dns_cache_timeout
Sets the time to save DNS information in memory by default of 120 seconds.
Curlopt_ftpsslauth
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.

curlopt_http_version
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).
Curlopt_httpauth
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.
curlopt_infilesize
Sets the size limit for the upload file, in bytes (byte).
Curlopt_low_speed_limit
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.
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.
curlopt_maxconnects
The maximum number of connections allowed, which is over Curlopt_closepolicy, determines which connections should be stopped.
Curlopt_maxredirs
Specify the maximum number of HTTP redirects that are used with curlopt_followlocation.
Curlopt_port
Used to specify the connection port. (option available)
Curlopt_protocols
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.

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

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

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

Curlopt_resume_from
Passes a byte offset (used to continue the breakpoint) when the transfer is resumed.
Curlopt_ssl_verifyhost
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.
curlopt_sslversion
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.
curlopt_timecondition
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.
Curlopt_timeout
Sets the maximum number of seconds that curl is allowed to execute.
Curlopt_timeout_ms
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.

Curlopt_timevalue
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:
Options
Optional value values
Note

Curlopt_cainfo
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.
Curlopt_capath
A directory that holds multiple CA certificates. This option is used in conjunction with Curlopt_ssl_verifypeer.
Curlopt_cookie
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 ").
Curlopt_cookiefile
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.
Curlopt_cookiejar
The file where the cookie information is saved after the connection ends.
Curlopt_customrequest
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.
Note:
Do not use before you determine the method that the server supports for 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 in 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 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.
Curlopt_postfields
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.
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 "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".
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 available encrypted lists.
Curlopt_sslcert
A file name that contains 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" (the default), "DER" and "ENG".
Added in 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 for asymmetric cryptographic operations.
Curlopt_sslkey
The file name that contains the SSL private key.
curlopt_sslkeypasswd
The password for the SSL private key specified in Curlopt_sslkey.
Note:
Since 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, supported by the key type "PEM" (the default), "DER" and "ENG".
Curlopt_url
The URL address you need to get, or you can set it in the Curl_init () function.
curlopt_useragent
A string that contains a "User-agent:" header in the HTTP request.
curlopt_userpwd
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:
Options
Optional value values
Note

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

Curlopt_httpheader
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 ')
Curlopt_postquote
After the FTP request execution completes, a set of FTP commands are executed on the server.
Curlopt_quote
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 ()):
Options
Optional value values

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, the value is a resource type.

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

Curlopt_writeheader
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:
Options
Optional value values

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

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

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

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

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

http://www.bkjia.com/PHPjc/327966.html www.bkjia.com true http://www.bkjia.com/PHPjc/327966.html 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 ...

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