正常写了一个简单的curl抓取程序,但是执行之后不管是访问本地还是远程url速度都超过10秒响应。这是为什么啊
注:程序里有一个10*10的for循环,需要执行100次。
注:程序里有一个10*10的for循环,需要执行100次。
解决方案 »
- 选中一个表tbl里的多项,怎么写比较清爽?
- <a href="?action=delete&messageid=<?=$result['mid']?>">delete</a>
- 用数据库存储图像的问题?
- 谁给个smarty分页的例子啊
- 关于SESSION
- 关于intval的一个问题
- 急求PHP导出表格到EXCEL!!!!!!!
- 关于 document.write 的问题
- 如何用php读出swf文件的width和height? getimagesize好像有时不行[急,在线等]
- 对ubuntu上的lamp开发环境的php扩展的安装困惑,对ubuntu上的php扩展的管理不是很明白
- CKeditor编辑模板文件的方法(默认源码模式编辑)?
- if(preg_match('/\D/', $page) )什么意思
for($x=0;$x<=9;$x++){
$z[]=$x;
}foreach($z as $x5){
foreach($z as $x6){
$final=$x5.$x6.'';
$url = "http://test1.edgesoft.cn/postvalue.php";
$post_data = array (
"number" => $final,
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$output = curl_exec($ch);
curl_close($ch);
//若某个结果包含某个信息 匹配则输出密码
if(count(explode('false',$output))==1){
echo "<span style='color: red;'> 输出密码$final 高亮</span></br>";
}
echo $output;
}
}
如下:
for($x=0;$x<=9;$x++){
$z[]=$x;
}foreach($z as $x5){
foreach($z as $x6){
$final=$x5.$x6.'';
$url = "http://test.localhost.cn/postvalue.php";
$post_data = array (
"number" => $final,
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$output = curl_exec($ch);
curl_close($ch);
//若某个结果包含某个信息 匹配则输出密码
if(count(explode('false',$output))==1){
echo "<span style='color: red;'> 输出密码$final 高亮</span></br>";
}
echo $output; ob_flush();
flush();
sleep(0.1);
ob_end_flush();
}
}
用sleep试验的时候总感觉在一开始的请求过程中会有一个缓慢的过程(类似阻塞,5秒左右),然后第一个提交返回之后就正常了。