Ok so I embraced matt_4013's while loop and Weedpacket's suggested improvement of fread() instead of fgets() and combined it into this:
$url_logo = 'http://localhost/interviews/images/PulcherFemina/PulcherFemina_thumb.jpg';
$url_logo_local = '_logo.jpg';
$fp = fopen($url_logo, "r");
while(!feof($url_logo)) {
$contents .= fread($fp, 4096);
}
fclose($fp);
$fp = fopen($url_logo_local, "w+");
fwrite($fp, $contents);
fclose($fp);
But this created an endless error page of invalid argument warnings... after looking at the manual's page for feof(); I thought of replacing $url_logo with $fp which makes the above:
$url_logo = 'http://localhost/interviews/images/PulcherFemina/PulcherFemina_thumb.jpg';
$url_logo_local = '_logo.jpg';
$fp = fopen($url_logo, "r");
while(!feof($fp)) {
$contents .= fread($fp, 4096);
}
fclose($fp);
$fp = fopen($url_logo_local, "w+");
fwrite($fp, $contents);
fclose($fp);
This seemed to work but when I tried my script with a big remote picture (230kB - 1024x768 full color jpg) as opposed to a small local picture like in the example above it took forever, and even after setting an execution limit of 120 seconds it would still not be enough for it to complete!
How can I avoid this? Is there any other way I can do this quicker? I don't know how to proceed from here...
I have one little idea which I still have to try but...