Hí there guys, I am writing a script to download a image from a url (ie http://server.com/image.jpg) and then to save it on my server. The problem is that I am using php4.0 something and I cant use copy coz it doesnt handle urls yet.
So, I thing I have to use fopen and such, but i just dont get it right. I have never used fopen and all those functions before. Heres my code:
$imageDir = "../../integrated/images/gallery/TEMP";
$image = fopen($the_url, r);
$read1 = fread($image, 10000000) OR DIE ("error 1");
$fileImage = $imageDir.".jpg";
$image2 = copy($read1, $fileImage);
$the_file = $fileImage;
Since this doesn't work at all, I'd be happy if someone could give me and example code that does work (sorry for beeing cheeky, but i'm a newbie). I have looked through the manual for hours, but without result.
I am using a form with a text-type inputbox for the url.
Cheers,
anders