Skip to content

Instantly share code, notes, and snippets.

@kicktv
Last active October 23, 2022 15:23
Show Gist options
  • Save kicktv/54aef82e1ac479af771da7b5e04d0f36 to your computer and use it in GitHub Desktop.
Save kicktv/54aef82e1ac479af771da7b5e04d0f36 to your computer and use it in GitHub Desktop.
php force download remote file
<?php
//php force download remote file
// Remote download URL
$remoteURL = 'http://www.html-editor.tk/videos/sintel.mp4';
// Force download
header('Content-type: application/octet-stream');
header("Content-Disposition: attachment; filename=".basename($remoteURL));
ob_end_clean();
readfile($remoteURL);
exit;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment