Phpcurl_init function usage

Source: Internet
Author: User
First, I opened the extensionphp_curldll function in phpini in Cwindows, and then restarted apapche. The following is what I wrote to capture PHP information in Baidu:

Php curl_init function usage

First, in php. ini in C \ windows, I opened the extension = php_curl.dll function, and then restarted apapche. The following is what I wrote to capture PHP information in Baidu:

  1. // Initialize curl
  2. $ Ch = curl_init () or die (curl_error ());
  3. Echo "test ";
  4. // Set URL parameters
  5. Curl_setopt ($ ch, CURLOPT_URL, "http://www.baidu.com/s? Wd = php ");
  6. // Request that CURL return data
  7. Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1 );
  8. // Execute the request
  9. $ Result = curl_exec ($ ch) or die (curl_error ());
  10. // Obtain the returned result and display it
  11. Echo $ result;
  12. Echo curl_error ($ ch );
  13. // Disable CURL
  14. Curl_close ($ ch );
  15. ?>

But why didn't we respond? No text for the test. if I put echo "test" on the first line, the output will be available. I guess the curl_init () function is not running yet!

Check whether CURL extension support is available in PHP phpinfo! Copy php_curl.dll to c: \ windows \ and c: \ windows \ system32, restart apache, and try again. instead of the php_curl.dll file, copy libeay32.dll and ssleay32.dll in the php directory to c: restart apache in \ windows \ system32.


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.