创建一个PHP文件,从某个站点下载所有链接 [英] Creating a PHP file that downloads all links from a certain site
问题描述
这是我在想的:
foreach(glob http://www.someaddress.ext/path/*.pk3)as $ link){
// do something to download ...
}
是的,就我所知道的。我想知道,只是通过流式启动下载即可实现...我不太了解我的方式,这不是我通常用PHP做的,而是触发了我的兴趣。
那么有谁知道如何解决这个问题?
我将你抛出正确的方向。
cURL 用于下载,并使用正则表达式获取链接中的所有路径。
请注意,一个网站可以是一个相对链接。所以你需要检查。
I recently installed the add-on "DownThemAll" into my firefox and as I watched it download a huge amount of pk3 files(map files for an opensource First Person Shooter), I wondered if I could do the same with PHP.
Here's what I'm thinking:
foreach(glob("http://www.someaddress.ext/path/*.pk3") as $link) {
//do something to download...
}
Yeah that's about as far as I've gotten. I'm wondering wheter to just initiate a download of to do it via a stream... I don't really know my way around this material, it's not what I usually do with PHP, but it's triggered my interest.
So is there anybody who knows how to tackle this problem?
I'll throw you in the right direction.
cURL for the downloading and a regular expression to get all the paths in the link.
Beware though, a link on a site can be a relative link. So you need to check for that.
这篇关于创建一个PHP文件,从某个站点下载所有链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!