tags:

views:

55

answers:

2

Hi,

I have a URL that's in this format

http://site.com/image.php?id=1

Each ID is a different photo, how can I save each image for 1000 ids?

+4  A: 

You can do something like (assuming they are jpg imags and your id's are all consecutive):

for($i=0;$i<=1000;$i++) {
    $url = 'http://site.com/image.php?id='.$i;
    file_put_contents('image'.$i.'.jpg', file_get_contents($url));
}
codaddict
+1  A: 

PHP has an inbuilt function for this, see http://php.net/manual/en/function.copy.php

Chaoley