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.
精彩评论