有谁知道为什么php5下的cURL可能会很慢,即使在45秒超时时也会失败,在一个speedO'light服务器上下载几个kb文件?cURL真的很慢
的代码是在这里的要求(虽然我调升超时更主要的脚本不执行过程中失败,并从最初的Chrome改变用户代理设置为Mozilla/4.0):
$ch = curl_init('http://www.somesite.com/' . $key);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_REFERER, 'http://www.somesite.com/somereferer/');
// curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/530.5 (KHTML, like Gecko) Chrome/2.0.172.39 Safari/530.5');
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0');
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_DNS_CACHE_TIMEOUT, 600);
发布您的代码或代码 – dusoft 2009-12-20 21:51:38
你好的那部分,欢迎到现场。你使用HTTP 1.1还是1.0? – 2009-12-20 22:15:13
好的,这里的代码和@Alix Axel,据我所知cURL默认发送HTTP 1.1请求,我没有改变 – mangefort 2009-12-21 01:29:00