Hi
I´ve written a skript, which downloads a file from server a to the local server where the skript is running.
This works with FTP-Downloads. I´ve used the FTP-Function of PHP.
Now I want, that this works with HTTP-Downloads too.
I´ve written this code:
<?
$src=fopen("http://www.server1.de/files/file1.zip","r");
$trg=fopen("/pfad/zum/ziel/file1.zip","w+");
while (!feof($src)) {
$contents = fread($src,65536);
$schreiben = fwrite($trg,$contents);
}
fclose ($trg);
fclose ($src);
?>
This works good as long as the filesize is under 8 MB.
If it´s more than 8 MB, then I receive the following error:
Fatal error: Allowed memory size of 8388608 bytes exhausted
Whats wrong?
I´ve tried a unset($contents) and $contents="" after the fwrite but the problem still exists.
I´m using PHP 4.0.3pl1
Does anyone know, how to solve this problem?