A detailed description of the curl correlation function in PHP

Source: Internet
Author: User
Keywords A detailed description of the curl correlation function in PHP
A detailed description of the curl correlation function in PHP

A detailed description of the curl correlation function in PHP


In PHP, you can use the power provided by curl by calling the following function.

curl_init-Initializes a curl dialog and returns a link resource handle

curl_exec-runs a Curl dialog that returns true successfully, otherwise false. If Curlopt_returntransfer is set, the response content is returned successfully, otherwise false

Curl_close-closes a conversation while freeing up resources

Curl_getinfo-gets the message of a Curl connection resource handle

curl_copy_handle-Copy all the contents and parameters of a Curl connection resource
curl_errno-returns a numeric number that contains the current dialog error message
curl_error-returns a char string that contains the current dialog error message

curl_multi_add_handle-Adding a separate curl handle resource to the Curl Batch dialog

curl_multi_init-Initializes a curl batch handle resource

curl_multi_exec-parsing a Curl batch handle

Curl_multi_close-closes a batch handle resource while freeing the resource
curl_multi_getcontent-returns the document flow of the obtained output
Curl_multi_info_read-gets the current resolved curl for the transfer message
curl_multi_rearouse_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-sets the dialog parameter as an array of curl for one
curl_setopt-set the dialog parameters for a curl
curl_version-getting Curl-related version messages



Examples of related functions:

The function of Curl_init () Initializes a curl dialog, the Curl_init () parameter of one of the parameters is optional, indicating a URL address.
The function of the curl_exec () parameter is to run one of the curl dialogs, and one parameter is the handle returned by the Curl_init () parameter.
The function of the curl_close () parameter is to close one of the curl dialogs, and one parameter is the handle returned by the Curl_init () parameter.

$ch = Curl_init ("http://www.php.cn/");
Curl_exec ($ch);
Curl_close ($ch);
?>



The function of the curl_version () parameter is to get curl about the version message, the curl_version () parameter has a parameter that is not clear what to do
------------------------------


Print_r (Curl_version ())
?>

-----------------------------

The function of the Curl_getinfo () parameter is to get a message for the Curl Connection resource handle, the Curl_getinfo () parameter 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.php.cn/");
Print_r (Curl_getinfo ($ch));
?&

Gt

-------------------------------------

The optional constants are:
*curlinfo_effective_url: The last valid URL address
*curlinfo_http_code: The last HTTP source code received
*curlinfo_filetime: The time to obtain a document remotely, if not available, return value "1"
*curlinfo_total_time: Time spent on the last transmission
*curlinfo_namelookup_time: Name resolution is consumed by
  • 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.