set_time_limit(0);<span style="white-space:pre"> </span>//加上这一个取消脚本执行的时间限制
如果要读取远程的网址,必须要在php.ini中开启 allow_url_fopen = on
批量抓取可以使用fsockopen写http协议;curl一套函数
foreach($ids as $v){
$html = file_get_contents('http://localhost/goods.php?id='.$v['id']);
file_put_contents('goods-'.$v['id'].'.html',$html);
}