I have used this code to copy a 45 mb zipfile from A server to B server.
<?php
set_time_limit(0);
$file = 'https://www.xxxxx.com/Products.zip';
$newfile = 'Products.zip';
if ( copy($file, $newfile) ) {
echo "Copy success!";
}else{
echo "Copy failed.";
}
?>
After copying 17 mb itis giving server error.
I have used some other codes to download or copy from server to server like
<?php
set_time_limit(0);
$url = 'https://www.mydomaind.com/Products.zip';
$path = 'Products.zip';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
curl_close($ch);
file_put_contents($path, $data);
echo 'done';
?>
Another one
<?php
set_time_limit(0);
$source =("https://www.mydomaind.com/Products.zip");
$destination = 'Produtcs.zip';
$data = file_get_contents($source);
$handle = fopen($destination, "w");
fwrite($handle, $data);
fclose($handle);
echo 'done';
?>
These last to code download or copy files like 5 mb easily. But when itry to same job for 50 mb. Gives error.
Please helpme how i can do that. Thanks