#change to exact path
$remote = '/';
$c = curl_init("ftp://$username:$password@ftp.domain.com/$remote");
$fh = fopen($local, 'w') or die($php_errormsg);
curl_setopt($c, CURLOPT_FILE, $fh);
curl_exec($c);
curl_close($c);