Code: Select all
$url = "http://www.example.com/catch/test.zip";
$file = "test.zip";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
set_time_limit(300);
curl_setopt($ch, CURLOPT_TIMEOUT, 300);
$handle = fopen($file, 'wb');
curl_setopt($ch, CURLOPT_FILE, $handle);
curl_exec($ch);
fclose($handle);
curl_close($ch);Is there a better way to transfer a file from one server to another?
Thanks