Answer the question
In order to leave comments, you need to log in
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
$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}"));
}
}
Write a program that will generate the desired URL, then download a file from it and save it to disk. Everything is simple.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question