I downloaded a PHP program example from the Internet that simulates logging into the discuz forum. During the trial run, the error message "Call to undefined function curl_init" appeared. There is no defined function, that is, PHP has not yet turned on support for the curl_init function. After searching on Google, I finally solved it. The method is as follows:
Take php+apache under Windows as an example.
First, open php.ini, find "extension=php_curl.dll", then remove the ";" comment in front and restart apache.
If this kind of problem still occurs, first check which directory the extension_dir value of php.ini is, and check whether there is php_curl.dll in that directory. If not, please download php_curl.dll, and then change the directory in the php directory. Copy libeay32.dll and ssleay32.dll to c:windowssystem32, restart apache, OK!
When running php under Ubuntu, it always prompts Call to undefined function curl_init(). The reason is not fixed: php5-curl
For curl-related content, please see: http://packages. ubuntu.com/zh-cn/intrepid/php5-curl
CURL is a library for getting files from FTP, GOPHER, HTTP server.
PHP5 is an HTML-embedded scripting language. Much of its syntax is borrowed from C, Java and Perl with a couple of unique PHP-specific features thrown in. The goal of the language is to allow web developers to write dinamically generated pages quickly. This version of PHP5 was built with the Suhosin patch .
H1>
(PHP 4 >= 4.0.2)
curl_init -- Initialize a CURL session
Description
int curl_init ([string url])
The curl_init() function will initialize a new session and return a CURL handle for use by the curl_setopt(), curl_exec(), and curl_close() functions. If the optional parameter is provided, the CURLOPT_URL option will be set to the value of this parameter. You can set it manually using the curl_setopt() function.
Example 1. Initialize a new CURL session and retrieve a web page
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL , "http://www.zend.com/");
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_exec ($ch);
curl_close ($ch );
?>
See: curl_close(), curl_setopt()