- 论坛徽章:
- 0
|
- PHP Version 4.3.4
- curl_init
- (PHP 4 >= 4.0.2, PHP 5)
- curl_init -- Initialize a CURL session
- Description
- resource curl_init ( [string url] )
- The curl_init() will initialize a new session and return a CURL handle for use with the curl_setopt(), curl_exec(), and curl_close() functions. If the optional url parameter is supplied then the CURLOPT_URL option will be set to the value of the parameter. You can manually set this using the curl_setopt() function. 例子 1. Initializing a new CURL session and fetching a webpage
- <?php
- // create a new curl resource
- $ch = curl_init();
- // set URL and other appropriate options
- curl_setopt($ch, CURLOPT_URL, "http://www.example.com/");
- curl_setopt($ch, CURLOPT_HEADER, 0);
- // grab URL and pass it to the browser
- curl_exec($ch);
- // close curl resource, and free up system resources
- curl_close($ch);
- ?>
-
复制代码
这段代码,我测试执行时出现这样的错误:
Fatal error: Call to undefined function: curl_init() in d:\appserv\www\test\curl.php on line 4
怎么回事呢 |
|