某些时候我们需要完成一个任务,把任务分成好多次完成,在网页里自我刷新,直到完成。
比如某个PHP(self.php):
实现不断处理有几个方式:
1 打开浏览器,访问此地址即可,让它自己跳转。如果有redirect限制,那最好可以改用脚本实现
2 wget方式
wget默认会follow返回的信息的location指令,但经过20次后就自动停止:
3 curl
curl默认不跟踪location指令
但加个参数即可:
其中 -L 即可follow,而默认是50次左右
自己可以设定多一些:
原创内容如转载请注明:来自 阿权的书房
比如某个PHP(self.php):
<?
//do something
sleep(1);
//redirect
header("location:self.php?t=".time());
?>OK!
//do something
sleep(1);
//redirect
header("location:self.php?t=".time());
?>OK!
实现不断处理有几个方式:
1 打开浏览器,访问此地址即可,让它自己跳转。如果有redirect限制,那最好可以改用脚本实现
2 wget方式
wget默认会follow返回的信息的location指令,但经过20次后就自动停止:
引用
20 redirections exceeded
3 curl
curl默认不跟踪location指令
但加个参数即可:
curl -h
...
-L/--location Follow Location: hints (H)
--location-trusted Follow Location: and send authentication even
to other hostnames (H)
-m/--max-time <seconds> Maximum time allowed for the transfer
--max-redirs <num> Maximum number of redirects allowed (H)
--max-filesize <bytes> Maximum file size to download (H/F)
...
...
-L/--location Follow Location: hints (H)
--location-trusted Follow Location: and send authentication even
to other hostnames (H)
-m/--max-time <seconds> Maximum time allowed for the transfer
--max-redirs <num> Maximum number of redirects allowed (H)
--max-filesize <bytes> Maximum file size to download (H/F)
...
其中 -L 即可follow,而默认是50次左右
引用
curl: (47) Maximum (50) redirects followed
自己可以设定多一些:
curl -L --max-redirs 100000 URL
原创内容如转载请注明:来自 阿权的书房
收藏本文到网摘
Amoeba for Mysql 试用小结
三里屯Village
