我正在尝试使用curl来抓取网页并通过电子邮件发送,但我的curl_exec($ch)
并未返回任何内容。这是我的代码:
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_URL, $URL);
$resultat = curl_exec($ch);
curl_close($ch);
在此代码中,$resultat
是空的......你们知道为什么吗?当我执行phpinfo()
时,我可以看到已启用卷曲。
编辑:
以下是curl_getinfo($ch)
结果:
Array
(
[url] => ***link hidden***
[content_type] => text/html
[http_code] => 200
[header_size] => 358
[request_size] => 93
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0.005051
[namelookup_time] => 0.001273
[connect_time] => 0.001904
[pretransfer_time] => 0.001931
[size_upload] => 0
[size_download] => 904
[speed_download] => 178974
[speed_upload] => 0
[download_content_length] => 904
[upload_content_length] => 0
[starttransfer_time] => 0.00503
[redirect_time] => 0
[certinfo] => Array ()
[primary_ip] => (HIDDEN)
[primary_port] => 80
[local_ip] => 192.168.145.80
[local_port] => 37648
[redirect_url] =>
)
答案 0 :(得分:0)
我的问题已经解决,因为在我的CURL页面中,我没有生成整个页面所需的数据库连接。一点点错误:)谢谢你的回答。