Home  >  Article  >  Backend Development  >  PHP client URL library-cURL

PHP client URL library-cURL

伊谢尔伦
伊谢尔伦Original
2016-11-21 17:36:161101browse

Introduction and installation configuration

The libcurl library created by Daniel Stenberg supported by PHP allows you to connect and communicate with various servers using various types of protocols. libcurl currently supports http, https, ftp, gopher, telnet, dict, file and ldap protocols. libcurl also supports HTTPS 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.

These functions were introduced in PHP 4.0.2.

In order to use PHP’s cURL function, you need to install the » libcurl package.

To use PHP’s cURL support, you must add the --with-curl[=DIR] option when compiling PHP. DIR is the directory path containing lib and include. There must be a folder named curl that contains easy.h and curl.h in the include directory. There should be a file named libcurl.a in the lib folder. For PHP 4.3.0 you can configure --with-curlwrappers to make cURL use URL streams.

Note: Win32 users note
To use this module in a Windows environment, libeay32.dll and ssleay32.dll must be placed in the directory included in the PATH environment variable. Do not use libcurl.dll from the cURL website.

cURL function

curl_close — Close a cURL session

curl_copy_handle — Copy a cURL handle and all its options

curl_errno — Return the last error number

curl_error — Return a string protecting the most recent error in the current session

curl_escape — URL encodes the given string

curl_exec — Execute a cURL session

curl_file_create — Create a CURLFile object

curl_getinfo — Get information about a cURL connection resource handle

curl_init — Initialize a cURL session

curl_multi_add_handle — to Add a separate curl handle to the curl batch session

curl_multi_close — Close a group of cURL handles

curl_multi_exec — Run a sub-connection of the current cURL handle

curl_multi_getcontent — If CURLOPT_RETURNTRANSFER is set, return the text stream of the obtained output

curl_multi_info_read — Get relevant transfer information for the currently parsed cURL

curl_multi_init — Return a new cURL batch handle

curl_multi_remove_handle — Remove a handle resource in the curl batch handle resource

curl_multi_select — Wait for activities in all cURL batches Connection

curl_multi_setopt — Set an option for the cURL multi handle

curl_multi_strerror — Return string describing error code

curl_pause — Pause and unpause a connection

curl_reset — Reset all options of a libcurl session handle

curl_setopt_array — cURL transfer Session batch setting option

curl_setopt — Set an option for a cURL transfer

curl_share_close — Close a cURL share handle

curl_share_init — Initialize a cURL share handle

curl_share_setopt — Set an option for a cURL share handle.

curl_strerror — Return string describing the given error code

curl_unescape — Decodes the given URL encoded string

curl_version — Get cURL version information


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn