Hello all,
I can download remote files using PHP but how do you download from a link that pushes headers out? I mean, you can click on some links and it will force a download and present you with dialog box to save the file. How can I download and save this sort of thing using PHP?
Any examples or links to tutorials would be great since I couldn't find anything useful on this topic.
Thank you for any help
Updated and [SOLVED]
<?php
set_time_limit(300);
// File to download
$remoteFile = $_GET['url'];
$file = fopen($remoteFile, "r");
if (!$file) {
echo "<p>Unable to open remote file.\n";
exit;
}
$line = '';
while (!feof ($file)) {
$line .= fgets ($file, 4096);
}
//readfile($line);
file_put_contents('here2.mp4', $line);
fclose($file);
?>