What is CURL and what functions can it implement? What is CURL curl? It is a File Transfer tool that uses the URL syntax in the command line mode. It supports many protocols: FTP, FTPS, HTTP, HTTPS, GOPHER, TELNET, DICT, FILE, and LDAP. Curl also supports HTTPS authentication, http post, http put, FTP upload, HTTP upload, proxy server, cookies, user name/password authentication, resumable download of downloaded files, and so on, powerful functions. Which functions are commonly implemented in PHP: 1. remote retrieval and content collection; 2. FTP upload and download for PHP Web edition; 3. Simulated login; 4. interface connection (API ), data transmission 5. Implement Cookie simulation 2. How does PHP use the CURL function 1? The first step in the entire operation is to use cur_init () initialize $ curl = curl_init ('www .php100.com '); 2 then, use the curl_setopt () function to set options. 3. execute the transaction curl_exec ($ curl); 4. Close curl_close (). 3. Use php curl for transmission and Retrieval. $ curl = curl_init (); // initialize a cURL object curl_setopt ($ curl, CURLOPT_URL, "http://www.php100.com"); // set the URL you need to crawl curl_setopt ($ curl, CURLOPT_RETURNTRANSFER, 1 ); // set the cURL parameter to save the result to the string or output to the screen. $ Data = curl_exec ($ curl); // run cURL and request the webpage curl_close ($ curl ); // close the URL request =============$ user = "admin"; $ pass = "admin100 "; $ curlPost = "user = $ user & pass = $ pass"; $ ch = curl_init (); curl_setopt ($ ch, CURLOPT_URL, "http: // localhost/edu/login. php "); curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 0); curl_setopt ($ ch, CURLOPT_POST, 1); curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ curlPost ); $ data = curl_exec ($ ch); curl_clo Se ($ ch); 1. Use CURL to simulate the login process and Step 2. Create a temporary file in tempnam. 3. Use CURL to simulate login to the bkJia Forum. <? Php $ cookie_file = tempnam ('. /temp ', 'cookier'); $ login_url = 'HTTP: // bbs.php100.com/login.php'?#post_fields = 'cktime = 31536000 & step = 2 & pwuser = php100-88 & pwpwd = 100 '; $ ch = curl_init ($ login_url); curl_setopt ($ ch, CURLOPT_HEADER, 0); curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ ch, CURLOPT_POST, 1 ); curl_setopt ($ ch, CURLOPT_POSTFIELDS, $ post_fields); curl_setopt ($ ch, CURLOPT_COOKIEJAR, $ cookie _ File); curl_exec ($ ch); curl_close ($ ch); $ url = 'HTTP: // bbs.php100.com/userpay.php'your keys ch = curl_init ($ url); curl_setopt ($ ch, CURLOPT_HEADER, 0); curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ ch, CURLOPT_COOKIEFILE, $ cookie_file); $ contents = curl_exec ($ ch ); preg_match ("/<li> ????? (. *) <\/Li>/", $ contents, $ arr); echo $ arr [1]; curl_close ($ ch);?>