开发者

Save images from URL with increasing number

I have the following URL,

http://site.com/productphotos/gallery_[1-1000]-l.jpg

After gallery_ there is a random number be开发者_开发百科tween 1 and 1000, how can I save all these images without saving them one by one with PHP?

Thank you in advance


You have to save them one by one. What you could do is using a keep-alive HTTP connection to transfer them - that would save some time.


curl "http://site.com/productphotos/gallery_[1-1000]-l.jpg" -O

But this will try all numbers between 1 and 1000 so you'll get those files created as well with 404 responses. You may avoid the 404s by additionally using the -f option.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜