Home  >  Article  >  Backend Development  >  PHP4 User Manual: Function-CURL_PHP Tutorial

PHP4 User Manual: Function-CURL_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 17:22:16924browse

XI. CURL, client URL library function
PHP supports libcurl (allowing you to connect and communicate with different servers using different protocols). , libcurl currently supports http, https, ftp, gopher, telnet, dict, file, and ldap protocols. libcurl also supports HTTPS certificate authorization, HTTP POST, HTTP PUT, FTP upload (of course you can also use PHP's ftp extension), HTTP basic form upload, proxies, cookies, and user authentication.
In order to use the CURL function you need to install the CURL package. PHP requires you to use CURL 7.0.2-beta or higher. If the version of CURL is lower than 7.0.2-beta, PHP will not work.
To use PHP's CURL support, you must recompile PHP with the --with-curl[=DIR] parameter (DIR is the directory containing libraries and header files).
These functions are new in PHP 4.0.2.
Once you compile PHP with CURL support, you can use the curl function. The basic idea is: you use the website construction server script class PHPPHP User Manual fancyfunction.curl-init.html>curl_init() function to initialize the CURL session, then you can set all your options, execute it through the curl_exec() function, and finally you can curl_close() function to end your session. The following is an example: retrieving the PHP home page into a file.
Example 1. Use PHP's CURL module to retrieve the PHP homepage Directory list curl_init — Initialize a CURL session curl_setopt — Set an option for the CURL call curl_exec — Execute a CURL session curl_close — Close a CURL session curl_version — Return the current CURL version

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532354.htmlTechArticleXI. CURL, client URL library function PHP supports libcurl (allows you to use different protocols to connect and communicate with different servers ). , libcurl currently supports http, https, ftp, gopher, telnet, dict, file, and...
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