You didn't state what the problem was with file_get_contents()
, so if your host is configured to allow it (allow_url_fopen = on
in php.ini), this should work:
$base_url = "http://domain.tld/images/";
foreach(range($id_start, $id_end) as $id) {
file_put_contents($path_to_save.$id.$sufix, file_get_contents($base_url.$id.$sufix));
}