Yesterday when I was using curl to write an API interface, I found that when I ran the Curl function, I was prompted by the call-to-undefined function curl_init () error, which, from the wrong point of view, did not define CURL_INIT (). It was later learned that this function must open a file in PHP, as follows.
Program code that's what I wrote.
The code is as follows |
Copy Code |
?? Php Initialize a CURL object $curl = Curl_init (); Set the URL you need to crawl curl_setopt ($curl, Curlopt_url, ' http://www.bKjia.c0m '); Set Header curl_setopt ($curl, Curlopt_header, 1); Sets the curl parameter, which requires the result to be saved to a string or output to the screen. curl_setopt ($curl, Curlopt_returntransfer, 1); Run Curl, request a Web page $data = curl_exec ($curl); Close URL Request Curl_close ($curl); Show the data obtained Var_dump ($data); |
The results suggest: call to undefined function curl_init (), and then Baidu a number of solutions, we can refer to.
Modify the configuration under Windows+apache:
1. Modify the php.ini, remove the semicolon in front of the Extension=php_curl.dll
2. Copy Libeay32.dll, Ssleay32.dll (C:APPSERVPHP5) two files to system32 directory
3. Restart Apache (services.msc) to
Linux+apache Solution:
You need to install the Curl package. If you're using Ubuntu, open the new Rieter Package Manager to search for curl and install curl
http://www.bkjia.com/PHPjc/632132.html www.bkjia.com true http://www.bkjia.com/PHPjc/632132.html techarticle yesterday when I was using curl to write an API interface, I found that when I ran the Curl function, I was prompted by the call to undefined function curl_init () error, from the error that there is no curl_init () function defined, after ...