Here is a php function to download files from remote server using curl.

$remote is url of source file.
$local is path where you need the file saved after download.


PHP Code:
function curl_download($remote$local)    {
    
$cp curl_init($remote);
    
$fp fopen($local"w");
    
    
curl_setopt($cpCURLOPT_FILE$fp);
    
curl_setopt($cpCURLOPT_HEADER0);
    
    
curl_exec($cp);
    
curl_close($cp);
    
fclose($fp);