I want to download a remote file with curl and output it instantly to the user. The user should think that he downloads the file from my server instead of a remote server. I cannot buffer the whole files because some files are larger than 200 MB. Also the user would have to wait for finish buffering till he could start downloading the file.
I found a script to download a file from remote server directly:
<?php
$file_name = $_GET['file'];
$file_url = 'http://www.remote.tld/' . $file_name;
header('Content-Type: application/octet-stream');
header("Content-Transfer-Encoding: Binary");
header("Content-disposition: attachment; filename=\"".$file_name."\"");
readfile($file_url);
exit;
?>
Is this kind of a direct remote download also possible with curl?