Download file from remote URL in server using curl in php so that you dont need to download in your system and upload again to your web server.
Another thing servers works very fast and you will be working as a controller and all the work will be done in between remote servers. You will be spared with use of data expenses while downloading and uploading. If you dont need this file in your local this is the best method to follow.
Just create a php file and put the below code inside.
Open this file in browser to run this and send the URL as a source parameter. It will automatically download the file with the same location where php file is created.
$source = $_REQUEST[‘source’];
$filename = basename($source).PHP_EOL;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $source);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data = curl_exec ($ch);
$error = curl_error($ch);
$destination = $filename;
$file = fopen($destination, “w+”);