brunosdiniz Posted May 10, 2008 Share Posted May 10, 2008 Hi everybody, I was wondering if there is a way of doing this: Suppose one cannot download say .exe or .zip files from a download site, but he/she knows the download url. Is there a way to have this file sent to an e-mail account as an attachment? I tried a couple of things with fopen, fread and fwrite but had no success. Any help will be much appreciated. Bruno Link to comment https://forums.phpfreaks.com/topic/104978-receiving-files-by-e-mail-to-bypass-firewall-download-restrictions/ Share on other sites More sharing options...
brunosdiniz Posted May 10, 2008 Author Share Posted May 10, 2008 I forgot to mention that the file has to be renamed first. eg.: fileName.zip.copy Link to comment https://forums.phpfreaks.com/topic/104978-receiving-files-by-e-mail-to-bypass-firewall-download-restrictions/#findComment-537342 Share on other sites More sharing options...
jonsjava Posted May 10, 2008 Share Posted May 10, 2008 haven't tested the code (going to now), but...: <?php if (isset($_POST['url'])){ $random_name = rand(0,10000000); $filename = $random_name.".copy"; $file = $_POST['url']; $absolute_path = "/absolute/path/to/store/files/"; $relative_path = "relitave/path/to/files/"; shell_exec("wget ".$file."--output-document=/absolute/path/to/store/file/".$filename); print "<a href='".$relative_path.$filename."'>Download</a><br />"; } echo <<<END <form method="POST" action="?"> <table border="0"> <tr> <td><input type="text" name="url"></td> </tr> <tr> <td><input type="submit" name="submit" value="submit"></td> </tr> </table> </form> END; ?> give me a sec to test it out. It doesn't email it to you, but it does allow you to get the file, if you can download anything other than .exe and .zip extensions. Link to comment https://forums.phpfreaks.com/topic/104978-receiving-files-by-e-mail-to-bypass-firewall-download-restrictions/#findComment-537345 Share on other sites More sharing options...
jonsjava Posted May 10, 2008 Share Posted May 10, 2008 corrected code: <?php if (isset($_POST['url'])){ $random_name = rand(0,10000000); $filename = $random_name.".copy"; $file = $_POST['url']; $absolute_path = "/absolute/path/to/store/files/"; $relative_path = "relitave/path/to/files/"; shell_exec("wget ".$file." --output-document=".$absolute_path.$filename); print "<a href='".$relative_path.$filename."'>Download</a><br />"; } echo <<<END <form method="POST" action="?"> <table border="0"> <tr> <td><input type="text" name="url"></td> </tr> <tr> <td><input type="submit" name="submit" value="submit"></td> </tr> </table> </form> END; ?> Link to comment https://forums.phpfreaks.com/topic/104978-receiving-files-by-e-mail-to-bypass-firewall-download-restrictions/#findComment-537347 Share on other sites More sharing options...
brunosdiniz Posted May 10, 2008 Author Share Posted May 10, 2008 jonsjava, thanks a lot for your help. As soon as I give it a try I´ll leve some feedback. Chears.. Link to comment https://forums.phpfreaks.com/topic/104978-receiving-files-by-e-mail-to-bypass-firewall-download-restrictions/#findComment-537486 Share on other sites More sharing options...
brunosdiniz Posted May 10, 2008 Author Share Posted May 10, 2008 Hi again, I tried your script on a page a created on this folder root/br1. It didn´t work, and I think It might have sometring to do with this variables: $absolute_path = "/br1/"; $relative_path = "/br1/"; You can access the page on this link: http://brunosdiniz.12gbfree.com/br1/teste.php Test file path: http://www.rarlab.com/rar/wrar371br.exe When you click on the download link it doesn´t find the file and redirects to the main page. Do you (or anyone) know why that is?? Thanks again. Link to comment https://forums.phpfreaks.com/topic/104978-receiving-files-by-e-mail-to-bypass-firewall-download-restrictions/#findComment-537729 Share on other sites More sharing options...
jonsjava Posted May 10, 2008 Share Posted May 10, 2008 absolute path is the path on the server (usually something like /home/user_name/www/folder/) relative path is the path relative to your web root (if it's http://example.com/test, then your relative path is /test/). Link to comment https://forums.phpfreaks.com/topic/104978-receiving-files-by-e-mail-to-bypass-firewall-download-restrictions/#findComment-537790 Share on other sites More sharing options...
brunosdiniz Posted May 12, 2008 Author Share Posted May 12, 2008 Me again.. Coudn´t figure out the absolute path on the freehost´s server I´m using. Did it work properly for you?? If so, was your test on an online server or local? Thanks a lot. Bruno. Link to comment https://forums.phpfreaks.com/topic/104978-receiving-files-by-e-mail-to-bypass-firewall-download-restrictions/#findComment-538709 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.