How to force download via remote url to any type of file [duplicate]

2

I would like to know how I can force the download via remote url to any type of file being my priority in case I force download of video media files online. Like for example of this url in question url of mentioned here

I thank you for being able to help me.

    
asked by anonymous 25.08.2015 / 06:32

2 answers

2

You can do with HTML only by using the download attribute in the <a> tag.

<a href="http://www.anistream.ga/videos/1352868579.mp4" download="http://www.anistream.ga/videos/1352868579.mp4">LINK</a>

    
25.08.2015 / 13:44
2

You can try something like this:

<?php
 $file_name = 'mov_bbb.mp4';
 $file_url = 'http://www.w3schools.com/html/' . $file_name;
 header('Content-Type: application/octet-stream');
 header("Content-Transfer-Encoding: Binary");
 header("Content-disposition: attachment; filename=\"".$file_name."\"");
 readfile($file_url);
 exit;

I tested it and it worked for me, you just put the path of the video and php forces it to work, so it works and fopen_wrappers enabled.

I found the answer here

    
25.08.2015 / 13:35