How to download files using url in php
You can download files directly using url or you can your files server to server using following code
1 : Using file_put_contents
set_time_limit(0);
file_put_contents("files.zip", fopen("Source Url", 'r'));
2 : Using curl
set_time_limit(0);
$aFopen = fopen('files.zip', "w");
$aOpts = array(
CURLOPT_FILE => $aFopen,
CURLOPT_TIMEOUT => 18000, // Set timeout duration in second
CURLOPT_URL => 'Source Url',
);
$curl = curl_init();
curl_setopt_array($curl, $aOpts);
curl_exec($curl);
curl_close($curl);