C
C
Chvalov2015-11-27 14:33:04
Automation
Chvalov, 2015-11-27 14:33:04

How to download all files from the site with the id of the file itself?

There is a site from which you need to download all the files, a link like this
site.ru/down/file.php?id=XXXXXXX
How can I substitute numbers from 0 to 9999999999 instead of XXXXXXX to download everything there.
And then the handles will be very long :)

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Alexander Melnichenko, 2015-11-27
@Chvalov

$url = 'http://site.ru/down/file.php';
$save_path = __DIR__;
for($i=0;$i<=999999;$i++){
       if (!file_exists($save_path."file_{$i}.png")){
  file_put_contents($save_path."file_{$i}.png",file_get_contents($url."?id={$i}"));
}
}

something like this

V
Vladimir Martyanov, 2015-11-27
@vilgeforce

Write a program that will generate the desired URL, then download a file from it and save it to disk. Everything is simple.

S
Sergey Savostin, 2015-11-27
@savostin

wget http://site.ru/down/file.php?id={0...9999999999}

Q
qwedfgbnm, 2015-12-01
@qwedfgbnm

using WinHTTrack

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question