1.CURL is an open source file Transfer tool that works with URL syntax in the command line mode.
2. It is widely used in UNIX and many Linux distributions. And there are DOS and Win32, Win64 under the transplant version number.
3. It supports very many protocols: FTP, FTPS, HTTP, HTTPS, GOPHER, TELNET, DICT, FILE, and LDAP.
4.CURL was developed by the Swedish Curll organization, you can visit: Http://curl.haxx. SE obtains its source code and related instructions.
5.PHP Curl Function List:
function |
Descriptive narrative |
Curl_close () |
Closes a curl session. |
Curl_copy_handle () |
Copy a curl handle and all of its options. |
Curl_errno () |
Returns the last error number. |
Curl_error () |
Returns a string that protects the current session's recent error. |
Curl_escape () |
Returns an escaped string. URL-encodes the given string. |
Curl_exec () |
Run a Curl session. |
Curl_file_create () |
Creates a Curlfile object. |
Curl_getinfo () |
Gets the information for a Curl connection resource handle. |
Curl_init () |
Initializes a curl session. |
Curl_multi_add_handle () |
Adds a separate curl handle to the curl batch session. |
Curl_multi_close () |
Closes a set of curl handles. |
Curl_multi_exec () |
Executes the child connection of the current CURL handle. |
Curl_multi_getcontent () |
Assuming that Curlopt_returntransfer is set, the text stream of the obtained output is returned. |
Curl_multi_info_read () |
Gets the related transport information for the currently resolved curl. |
Curl_multi_init () |
Returns a new curl batch handle. |
Curl_multi_remove_handle () |
Removes a handle resource from the Curl batch handle resource. |
Curl_multi_select () |
Wait for the active connection in all curl batches. |
Curl_multi_setopt () |
Set up a batch curl transfer option. |
Curl_multi_strerror () |
Returns a string literal describing the error code. |
Curl_pause () |
Pause and resume the connection. |
Curl_reset () |
Resets all options for the Libcurl session handle. |
Curl_setopt_array () |
Bulk setup options for the Curl transfer session. |
curl_setopt () |
Set a curl transfer option. |
Curl_share_close () |
Close the curl shared handle. |
Curl_share_init () |
Initializes a curl shared handle. |
Curl_share_setopt () |
Sets the curl Transfer option for a shared handle. |
Curl_strerror () |
Returns a string descriptive description of the error code. |
Curl_unescape () |
Decodes a URL-encoded string. |
Curl_version () |
Gets the Curl version number information. |
Basic Steps for 6.CURL development
(1) Initialization: Curl_init ()
(2) Set Variable: curl_setopt () or Curl_setopt_array ()
(3) Run and get results: curl_exec ()
(4) Release curl handle: Curl_close ()
Summary of 7.CURLOPT references:
Curlopt_autoreferer
Voluntarily set the Referer information in the header
Curlopt_binarytransfer
Gets the data back when Curlopt_returntransfer is enabled
Curlopt_cookiesession
When enabled, curl passes only one session cookie, ignoring other cookies, and by default, curl returns all cookies to the server. Session cookies are cookies that are used to infer whether the session on the server side 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. This entry is thread-safe and defaults to true.
Curlopt_failonerror
Displays the HTTP status code, with the default behavior of ignoring HTTP messages with numbers less than or equal to 400
Curlopt_filetime
When enabled, attempts to change the information in the remote document. The resulting information is returned through the curlinfo_filetime option of the Curl_getinfo () function.
Curlopt_followlocation
When enabled, the "location:" returned by Serverserver is returned to the server recursively in the header, using Curlopt_maxredirs to limit the number of recursive returns.
Curlopt_forbid_reuse
After the interaction is forced to disconnect, can not be reused.
Curlopt_fresh_connect
Forces a new connection to be taken in place of the connection in the cache.
Curlopt_ftp_use_eprt
Curlopt_ftp_use_epsv
Curlopt_ftpappend
Curlopt_ftpascii
Curlopt_ftplistonly
Curlopt_header
When enabled, the information for the header file is output as a data stream.
Curlopt_httpget
When enabled, the method for HTTP is set to get. Because get is the default, it is used only if it is changed.
Curlopt_httpproxytunnel
When enabled, it is transmitted over an HTTP proxy.
Curlopt_mute
Restores the default value by talking about all the changed parameters in the Curl function.
Curlopt_netrc
After the connection is established, visit the ~/.netrc file for username and password information to connect to the remote Web site.
Curlopt_nobody
When enabled, the body portion of the HTML is output incorrectly.
Curlopt_noprogress
Turns off the progress bar of the curl transfer when enabled. The default setting for this entry is true
Curlopt_nosignal
When enabled, ignores all of the signals that curl passes to PHP. This entry is turned on by default when SAPI multi-threaded transmissions.
Curlopt_post
When enabled, a regular post request is sent. The type is: application/x-www-form-urlencoded, just like the form submitted.
Curlopt_put
Allow HTTP to send files when enabled, Curlopt_infile and curlopt_infilesize must be set at the same time
Curlopt_returntransfer
The information obtained by CURL_EXEC () is returned in the form of a file stream, rather than as a direct output.
Curlopt_ssl_verifypeer
Curlopt_transfertext
Curlopt_unrestricted_auth
Username and password information is continuously appended to multiple locations in the header generated using curlopt_followlocation, even if the domain name has changed.
Curlopt_upload
Consent to File transfer when enabled
Curlopt_verbose
All information is reported when enabled and stored in stderr or specified curlopt_stderr
Curlopt_buffersize
The size of the cache is read in each fetch of the data. This value will be filled every time.
Curlopt_closepolicy
Not curlclosepolicy_least_recently_used is curlclosepolicy_oldest, there are three other, but Curl temporarily does not support.
Curlopt_connecttimeout
The time to wait before initiating the connection, assuming that it is set to 0, does not wait.
Curlopt_dns_cache_timeout
Sets the time that DNS information is saved in memory. It feels like 120 seconds.
Curlopt_ftpsslauth
Curlopt_http_version
Sets the HTTP protocol used by Curl. Curl_http_version_none (let CURL himself infer), Curl_http_version_1_0 (http/1.0). Curl_http_version_1_1 (http/1.1)
Curlopt_httpauth
The optional values for the HTTP authentication method used are: Curlauth_basic. Curlauth_digest. Curlauth_gssnegotiate,curlauth_ntlm,curlauth_any. Curlauth_anysafe. Ability to use ' | ' operator separates multiple values, curl allows the server to 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
Set the size of the upload file
Curlopt_low_speed_limit
When the transfer speed is less than Curlopt_low_speed_limit, PHP will infer based on curlopt_low_speed_time whether it is too slow to cancel the transfer.
Curlopt_low_speed_time
The number of seconds the transfer should is below Curlopt_low_speed_limit for PHP to consider the transfer too slow and a Bort.
When the transfer speed is less than curlopt_low_speed_limit. PHP is based on Curlopt_low_speed_time to infer whether the transfer was canceled because it was too slow.
Curlopt_maxconnects
The maximum number of connections that are agreed upon will be determined by curlopt_closepolicy which connections should be stopped
Curlopt_maxredirs
Specify the maximum number of HTTP redirects that are used with curlopt_followlocation.
Curlopt_port
An optional to specify the amount of port to connect to
Curlopt_proxyauth
Curlopt_proxyport
Curlopt_proxytype
Curlopt_resume_from
Pass a byte offset (used to resume a breakpoint) when the transfer is resumed
Curlopt_ssl_verifyhost
Curlopt_sslversion
Curlopt_timecondition
This is assumed to have been edited after a certain time specified by Curlopt_timevalue. Use Curl_timecond_ifmodsince to return to the page. Assuming that it has not been altered, and that Curlopt_header is true, the header,curlopt_header that returns a "304 not Modified" is false, use Curl_timecond_isunmodsince , the default value is Curl_timecond_ifmodsince
Curlopt_timeout
Set the maximum number of seconds that Curl agrees to run
Curlopt_timevalue
Set the timestamp used by a curlopt_timecondition, using curl_timecond_ifmodsince in the default state
Curlopt_cainfo
Curlopt_capath
Curlopt_cookie
Set the contents of the "Set-cookie:" section of the HTTP request.
Curlopt_cookiefile
The file name that includes the cookie information, which can be the header information in Netscape format or HTTP style.
Curlopt_cookiejar
After the connection is closed. File name for storing cookie information
curlopt_customrequest
curlopt_egbsocket
curlopt_encoding
Header Accept-encoding: "Part of the content, supported by the encoding format:" Identity "," deflate "," gzip ". If set to an empty string, this means that all encoding formats are supported
Curlopt_ftpport
Curlopt_interface
The name used in the external network interface, which can be an interface name, IP, or host name. The
Curlopt_krb4level
KRB4 (Kerberos 4) Security level setting can be one of several values: "Clear". "Safe". "Confidential", "private". The default value is "private". When set to NULL, the KRB4 is disabled, and now KRB4 security can only be used in FTP transmissions. The
Curlopt_postfields
POST operation in HTTP.
If you want to transfer a file, you need a file name at the beginning of the @
Curlopt_proxy
Setting HTTP proxy server
Curlopt_proxyuserpwd
Username and password that are connected to the proxy server in the format "[Username]:[password]".
Curlopt_random_file
Sets the file name of the random number seed used to hold SSL
Curlopt_range
Set the HTTP transport range. The ability to set a transmission interval in the form of "X-y", assuming that there are multiple HTTP transports, separate multiple values with commas. Form: "X-y,n-m".
Curlopt_referer
Sets the value of the "REFERER:" section in the header. The
curlopt_ssl_cipher_list
Curlopt_sslcert
Passes a string that includes a PEM-formatted certificate. The
curlopt_sslcertpasswd
Passes a password that includes the required use of the Curlopt_sslcert certificate.
Curlopt_sslcerttype
curlopt_sslengine
Curlopt_sslengine_default
Curlopt_sslkey
curlopt_sslkeypasswd
Curlopt_sslkeytype
Curlopt_url
need to get the URL address, also can in PHP curl_init () Set in the function.
Curlopt_useragent
A string that includes a "user-agent" header in the HTTP request.
Curlopt_userpwd
Pass the username and password needed in a connection. The format is: "[Username]:[password]".
Curlopt_http200aliases
Sets the response to HTTP 200, which is no longer handled as error, in the form of an array.
Curlopt_httpheader
Sets an array of contents to transfer in a header.
Curlopt_postquote
Curlopt_quote
Curlopt_file
Sets the location of the output file. The value is a resource type, which defaults to the stdout (browser).
Curlopt_infile
The file address to be read when uploading the file, the value is a resource type.
Curlopt_stderr
Set an error output address, the value is a resource type, in place of the default stderr.
Curlopt_writeheader
Sets the file address to write the header portion of the content, and the value is a resource type.
Curlopt_headerfunction
Set a callback function that has two parameters. The first one 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 is the resource handle for curl, the second is a password prompt, and the third parameter is the maximum value agreed by the password length.
Returns the value of the password.
Curlopt_readfunction
Set a callback function with two parameters. The first one is the resource handle for curl, and the second is the data to read. Data reads must depend on this function. Returns the size of the read data, for example, 0 or EOF.
Curlopt_writefunction
Set a callback function with two parameters. The first is a resource handle for curl. The second is the data that is written. Data writes must depend on this function. Returns the exact size of the written data
Summary of 8.CURLINFO references:
Curlinfo_effective_url
The last valid URL address
Curlinfo_http_code
The last HTTP code received
Curlinfo_filetime
The time to obtain the document remotely, assuming that it cannot be obtained, the return value is "1"
Curlinfo_total_time
Time spent on the last transmission
Curlinfo_namelookup_time
Time consumed by name resolution
Curlinfo_connect_time
Time spent establishing a connection
Curlinfo_pretransfer_time
The time to use from establishing a connection to preparing the transfer
Curlinfo_starttransfer_time
The time used to start the connection to the start of the transfer
Curlinfo_redirect_time
The time that the redirect was used before the transaction transfer started
Curlinfo_size_upload
Total amount of uploaded data
Curlinfo_size_download
Total amount of downloaded data
Curlinfo_speed_download
Average download speed
Curlinfo_speed_upload
Average upload speed
Curlinfo_header_size
The size of the header section
Curlinfo_header_out
Send the requested string
Curlinfo_request_size
The size of the request that has the problem in the HTTP request
Curlinfo_ssl_verifyresult
Curlinfo_content_length_download
Download content length read from Content-length:field
Curlinfo_content_length_upload
Description of upload content size
Curlinfo_content_type
Download the "Content-type" value of the content, NULL indicates that the server did not send a valid "Content-type:header"
PHP CURL Chinese Description