Default How To download multiple files simultaneously with php

nalza

Newbie
Joined
Feb 11, 2008
Messages
7
Reaction score
2
Hi

i need a simple php code but i can't seem to figure it out since i am not a php expert

i have a list of image url in a text file (say image.txt).

i want to run a php script to get all the image from that url file and save it to images folder on my server.

have been searching for hours but just could not make this to work.

any help would be much appreciated.

thank you.
 
PHP:
<?php
$file1 = "./image.txt";
$lines = file($file1);
foreach($lines as $line_num => $line)
{
$png = imagecreatefrompng("$line");
imagegif($png, "./$i.gif");
imagedestroy($png);
$i++;
}
?>

This will work corectly only for PNG files. It will save all files from your list as:
1.gif
2.gif
3.gif

etc.
 
you can also use

HTML:
imagecreatefromjpeg
imagecreatefromgif
 
Back
Top