I need to download remote file using curl.
Here's the sample code I have:
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $st = curl_exec($ch); $fd = fopen($tmp_name, 'w'); fwrite($fd, $st); fclose($fd); curl_close($ch);
But it can't handle big files, because it reads to memory first.
Is it possible to stream the file directly to disk?