curl_close-closing a Curl session
curl_copy_handle-Copy all the contents and parameters of a Curl connection resource
curl_errno-returns a numeric number that contains the current session error information
curl_error-returns a string containing the current session error message
Curl_exec-performing a Curl session
Curl_getinfo-gets the information for a Curl connection resource handle
curl_init-initialization of a curl session
curl_multi_add_handle-Adding a separate curl handle resource to a curl batch session
curl_multi_close-closing a batch handle resource
curl_multi_exec-parsing a Curl batch handle
curl_multi_getcontent-returns the text stream of the obtained output
Curl_multi_info_read-Gets the related transfer information for the currently resolved curl
curl_multi_init-initializing a curl batch handle resource
curl_multi_remove_handle-removing a handle resource from the Curl batch handle resource
Curl_multi_select-get all the sockets associated with the CURL extension, which can and be "selected"
curl_setopt_array-set session parameters as an array for a curl
curl_setopt-setting session parameters for a curl
curl_version-getting the version information about Curl
The Curl_init () function Initializes a curl session, and the only parameter to the Curl_init () function is optional, representing a URL address.
The function of the curl_exec () function is to perform a curl session, and the only argument is the handle returned by the Curl_init () function.
The function of the Curl_close () function is to close a curl session, and the only argument is the handle returned by the Curl_init () function.
$ch = Curl_init ("http://www.baidu.com/");
Curl_exec ($ch);
Curl_close ($ch);
?>
The Curl_version () function is to get curl-related version information, and the Curl_version () function has a parameter that is not clear what to do
Print_r (Curl_version ())
?>
The Curl_getinfo () function is to get information about a Curl connection resource handle, the Curl_getinfo () function has two parameters, the first parameter is the resource handle of curl, and the second parameter is the following constants:
$ch = Curl_init ("http://www.baidu.com/");
Print_r (Curl_getinfo ($ch));
?>
The optional constants are:
Curlinfo_effective_url
The last valid URL address
Curlinfo_http_code
The last HTTP code received
Curlinfo_filetime
The time that the document was retrieved remotely, and the return value is "1" if it cannot be obtained
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 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
Result of SSL certification verification requested by setting Curlopt_ssl_verifypeer
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"
The function of the curl_setopt () function is to set the session parameters for a curl. The function of the Curl_setopt_array () function is to set the session parameters for a curl in the form of an array.
$ch = Curl_init ();
$fp = fopen ("Example_homepage.txt", "w");
curl_setopt ($ch, Curlopt_file, $fp);
$options = Array (
Curlopt_url = ' http://www.baidu.com/',
Curlopt_header = False
);
Curl_setopt_array ($ch, $options);
Curl_exec ($ch);
Curl_close ($ch);
Fclose ($FP);
?>
The parameters that can be set are:
Curlopt_autoreferer
Automatically set the Referer information in the header
Curlopt_binarytransfer
Gets the data back 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 is true by default.
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 modify 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 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
TRUE to use EPRT (and LPRT) when doing active FTP downloads. Use FALSE to disable EPRT and lprt and use PORT only.
Added in PHP 5.0.0.
Curlopt_ftp_use_epsv
TRUE to first try a EPSV command for FTP transfers before reverting back to PASV. Set to FALSE to disable EPSV.
Curlopt_ftpappend
TRUE to append to the remote file instead of overwriting it.
Curlopt_ftpascii
An alias of Curlopt_transfertext. Use that instead.
Curlopt_ftplistonly
TRUE to the list the names of an FTP directory.
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, 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.
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 item is true
Curlopt_nosignal
When enabled, ignores all 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 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 in the form of a file stream, rather than as a direct output.
Curlopt_ssl_verifypeer
FALSE to stop CURL from verifying the peer ' s certificate. Alternate certificates to verify against can is specified with the Curlopt_cainfo option or a certificate directory can is Specified with the Curlopt_capath option. Curlopt_ssl_verifyhost may also need to be TRUE or FALSE if curlopt_ssl_verifypeer are disabled (it defaults to 2). TRUE by default as of CURL 7.10. Default bundle installed as of CURL 7.10.
Curlopt_transfertext
TRUE to use an ASCII mode for FTP transfers. For LDAP, it retrieves the data in plain text instead of HTML. On Windows systems, it won't 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 transfer when enabled
Curlopt_verbose
All information is reported when enabled and stored in stderr or specified curlopt_stderr
Curlopt_buffersize
Each time the retrieved data is read into the cache size, the value is filled every time.
Curlopt_closepolicy
Not curlclosepolicy_least_recently_used is curlclosepolicy_oldest, there are three other, but Curl is not supported for the time being.
Curlopt_connecttimeout
The time to wait before initiating the connection, and if set to 0, do not wait.
http://www.bkjia.com/PHPjc/319643.html www.bkjia.com true http://www.bkjia.com/PHPjc/319643.html techarticle curl_close-Close A Curl session curl_copy_handle-copy all contents and parameters of a Curl connection resource curl_errno-Returns a numeric number containing the current session error information ...