0
我正在使用Windows 7.我已安装XAMPP 1.8.0并启用了CURL功能。但是,我仍然无法抓取网页。Curl功能在XAMPP中不起作用1.8.0
我用下面的代码段:
<?php
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://www.google.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: Maximum execution time of 30 seconds exceeded in
C:\xampp\htdocs\testing\curl.php on line 14
14行:curl_close($ch)
为什么我得到这样的e RROR?我该如何调试它?请帮帮我。
编辑答案请检查一下:) – 2013-02-20 12:55:02
参考链接:http://stackoverflow.com/questions/6935710/time -of-30-seconds-exceeded-error-file-get-contents – 2013-02-20 12:55:42
[code] <?php //创建一个新的cURL资源 set_time_limit(120); [/ code] $ ch = curl_init(); //设置URL和其他适当的选项 curl_setopt($ ch,CURLOPT_TIMEOUT,120); curl_setopt($ ch,CURLOPT_URL,“http://www.google.com”); curl_setopt($ ch,CURLOPT_HEADER,0); //抓取URL并将其传递给浏览器 curl_exec($ ch)或die(curl_errno($ ch)。“:Can not execute it”); //关闭cURL资源,释放系统资源 curl_close($ ch); ?> [/ code] – muneermunnar 2013-02-20 18:54:02