日期:2014-05-17 浏览次数:20577 次
$mh = curl_multi_init(); // 开启多线程
$i = 0;
foreach($url_array as $url) {
$ch = curl_init();
if (IS_PROXY) {
curl_setopt ($ch, CURLOPT_PROXY,'67.215.228.129:8089' );//60.12.226.18
}
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return don't print
curl_setopt($ch, CURLOPT_TIMEOUT, 30); //设置超时时间
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); // 302 redirect
curl_setopt($ch, CURLOPT_MAXREDIRS, 7); //HTTp定向级别
curl_multi_add_handle($mh, $ch); // 把 curl resource 放进 multi curl handler 里
$handle[$i++] = $ch;
}
[url] => http://blog.51edm.org/content/uploadfile/201303/dc7f1364286796.zip
[content_type] => application/zip
[http_code] => 206
[header_size] => 313
[request_size] => 221
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0.047
[namelookup_time] => 0
[connect_time] => 0.047
[pretransfer_time] => 0.047
[size_upload] => 0
[size_download] => 201
[speed_download] => 0
[speed_upload] => 0
[download_content_length] => 201
[upload_content_length] => 0
[starttransfer_time] => 0.078
[redirect_time] => 0
[certinfo] => Array
(
)
[primary_ip]&nbs