Last active
October 23, 2022 15:23
-
-
Save kicktv/54aef82e1ac479af771da7b5e04d0f36 to your computer and use it in GitHub Desktop.
php force download remote file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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