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.