Php uses curl to simulate post with get

Source: Internet
Author: User
You need to enable curlphp for windows testing on the local machine. iniextensionphp_curl.dll restart apacheinclude (Curl. php); $ cunewQP_Curl_Curl (); $ s $ cu-get (www.baidu.com); echo $ s; Curl. php can use the Curl component in the framework www.myquickphp.com. php *** CURL Tool

In windows testing, you need to enable curl php. ini extension = php_curl.dll restart apache include ('curl. php '); $ cu = new QP_Curl_Curl (); $ s = $ cu-get ('HTTP: // www.baidu.com'); echo $ s; Curl. php can use the curl.php/*** CURL tool in the framework of http://www.myquickphp.com/

For windows testing on the local machine, you need to enable curl php. ini.

Extension = php_curl.dll


Restart apache

include ('Curl.php');$cu=new QP_Curl_Curl();$s=$cu->get('http://www.baidu.com');echo $s;


Curl. php can use curl.php in the framework of http://www.myquickphp.com/

/*** CURL tool ** @ category QuickPHP (II) * @ copyright http://www.myquickphp.com * @ version $ Id: Curl. php 904: 02Z yuanwei $ * // ** ================== the following functions are supported ================ 1: supports ssl connections and proxy connections. 2. automatic support for cookies. 3. Simple GET/POST operations. 4. Support for uploading a single file or multiple files with the same field, supports relative or absolute paths. 5: Server Information and server Header information before and after the request are returned. 6: The lighttpd server is automatically supported. 7: the REFERER reference page is automatically set. 8: automatically supports Server 301 redirection or rewriting (thanks to Zheng GG) 9: other options, such as custom port, timeout, USERAGENT, Gzip compression, etc. ========================================/// obtain the CURL object $ cu = QP_Sys:: load ('curl'); // obtain the content of the baidu homepage echo $ cu-> get ('HTTP: // www.baidu.com '); // send it to http ://
 
  
/A. php sends POST Data echo $ cu-> post ('HTTP ://
  
   
/A. php', array ('id' => 1, 'name' => 'v go'); // to http ://
   
    
/Upload. php upload File echo $ cu-> post ('HTTP ://
    
     
/. Php ', array (), array ('img' => 'file/a.jpg '); // obtain all debugging information print_r ($ cu-> getinfo ()); // set the callback (common function) echo $ cu-> set (array ('callback' => 'print _ R')-> get ('HTTP ://
     
      
/Get. php ', array ('id' => 10); // sets the callback (Controller method) echo $ cu-> set (array ('callback' => array ($ this, 'curllog')-> get ('HTTP ://
      
        /Get. php ', array ('id' => 10); // sets the callback (static method) echo $ cu-> set (array ('callback' => array ('qp _ Sys ', 'dump')-> get ('HTTP ://
       
         /Get. php', array ('id' => 10 ));*/
       
      
     
    
   
  
 

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.