May 11, 2021 PHP
cURL is a very powerful open source library that supports many protocols, including HTTP, FTP, TELNET, etc., which we use to send HTTP requests.
PhP-supported libcurl libraries created by Daniel Stenberg allow you to connect and communicate with a variety of servers using various types of protocols.
Libcurl currently supports https, https, ftp, gopher, telnet, dict, file, and ldap protocols. Libcurl also supports HTTPPS authentication, HTTP POST, HTTP PUT, FTP upload (this can also be done through PHP's FTP extension), HTTP form-based upload, proxy, cookies, and username-password authentication.
PHP uses cURL to implement the Get and Post request methods
These functions are introduced in PHP 4.0.2.
In order to use PHP's cURL function, you need to install the libcurl package.
PHP requires libcurl 7.0.2-beta or later. T o use cURL in PHP 4.2.3, you need to install 7.9.0 or later libcurl. S tarting with PHP 4.3.0, you need to install libcurl 7.9.0 or later. Starting with PHP 5.0.0 you need to install 7.10.5 or later libcurl.
To use PHP's cURL support, you must add the -with-curl option when compiling PHP, which is the directory path that contains lib and include. T here must be a folder named curl in the include directory that contains easy.h and curl.h. T here should be a file named libcurl.a in the lib folder. For PHP 4.3.0 you can configure --with-curlwrappers to make the cURL use the URL stream.
Note: Win32 users note To use this module in a Windows environment, libeay32.dll and ssleay32.dll must be placed in the directory contained in the PATH environment variable.
You don't have to use libcurl on the .dll.
This extension defines the resources in 2: the cURL handle and the cURL batch handle.
The following contains a list of PHP cURL functions:
function | describe |
---|---|
curl_close() | Close a CURL session. |
curl_copy_handle() | Copy a CURL handle and all its options. |
curl_errno() | Returns the last error number. |
curl_error() | Returns a string that protects the current session's last mistake. |
curl_escape() | Returns the righteous string, perform URL encoding for a given string. |
curl_exec() | Perform a CURL session. |
curl_file_create() | Create a CURLFILE object. |
curl_getinfo() | Get information of a CURL connection resource handle. |
curl_init() | Initialize a CURL session. |
curl_multi_add_handle() | Add a separate CURL handle to the CURL batch session. |
curl_multi_close() | Close a set of CURL handles. |
curl_multi_exec() | Run the sub-connection of the current CURL handle. |
curl_multi_getcontent() | If you set the curlopt_returntransfer, return the text stream for the obtained output. |
curl_multi_info_read() | Get related transmission information of the currently resolved CURL. |
curl_multi_init() | Returns a new CURL batch handle. |
curl_multi_remove_handle() | Remove a handle resource in the CURL batch handle resource. |
curl_multi_select() | Waiting for the activity connection in all CURL batch. |
curl_multi_setopt() | Set a batch of CURL transfer options. |
curl_multi_strerror() | Returns a string text describing the error code. |
curl_pause() | Pause and restore connections. |
curl_reset() | Reset all the options for the session handle of libcurl. |
curl_setopt_array() | Transfer session setting options for the CURL. |
curl_setopt() | Set a CURL transfer option. |
curl_share_close() | Turn off the CURL shared handle. |
curl_share_init() | Initialize the CURL shared handle. |
curl_share_setopt() | Set up a CURL transfer option for a shared handle. |
curl_strerror() | Returns a string description of the error code. |
curl_unescape() | Decoding the string after the URL encoded. |
curl_version() | Get the CURL version information. |
Next, you'll touch the Date/Time function of PHP5.