How does PHP open the Curl function?

Source: Internet
Author: User
Tags curl ini

If I do a test first, we php.ini.

Code

The code is as follows

$ch = Curl_init ();
curl_setopt ($ch, Curlopt_url, "http://www.111cn.net");
curl_setopt ($ch, Curlopt_header, false);
curl_setopt ($ch, Curlopt_returntransfer, 1); If this line is commented out, it will be directly output
$result =curl_exec ($ch);
Curl_close ($ch);

Error tips

Fatal error:call to undefined function curl_init () into e:/www/test.php on line 4

This is to tell us that the function is undefined, this is how the PHP built-in function may not be defined, we look at the php.ini file and find the following status

; Extension=php_curl.dll

This is not turned on, let's get rid of the front number first.

Extension=php_curl.dll

Restart Apache and then run the following code effect

Successfully visited the Www.111cn.net website.

Summing up, in fact, the use of curl is very simple, we just php.ini in the extension=php_curl.dll in front of the number can be removed.

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.