Well, this one seems quite simple, and it is. All you have to do to download a file to your server is:
file_put_contents(\"Tmpfile.zip\", file_get_contents(\
Try using cURL
set_time_limit(0); // unlimited max execution time
$options = array(
CURLOPT_FILE => '/path/to/download/the/file/to.zip',
CURLOPT_TIMEOUT => 28800, // set this to 8 hours so we dont timeout on big files
CURLOPT_URL => 'http://remoteserver.com/path/to/big/file.zip',
);
$ch = curl_init();
curl_setopt_array($ch, $options);
curl_exec($ch);
curl_close($ch);
I'm not sure but I believe with the CURLOPT_FILE
option it writes as it pulls the data, ie. not buffered.