Monoxide Posted August 9, 2007 Share Posted August 9, 2007 I'm looking for a PHP site or file or something that will download a remote file to the host it is on. The best I can explain what I am trying to do is something like torrentflux does with torrent files, grabs the url and downloads the torrent right to my host. now I would just like to do that with FTP or HTTP saving me the time of downloading each file then uploading each file to my host. :'( edit: would there be a way to modify an upload script to download a file from another host? Quote Link to comment https://forums.phpfreaks.com/topic/64106-hard-question-php-download-upload-remote-mix/ Share on other sites More sharing options...
lemmin Posted August 9, 2007 Share Posted August 9, 2007 You should be able to use most of the FileSystem functions to do this. fopen(), fread(), fwrite(). open the file read it to a buffer and write it to the host. Here is the filesystem documentation: http://www.php.net/manual/en/function.fopen.php Other functions like readfile() might even work better. Quote Link to comment https://forums.phpfreaks.com/topic/64106-hard-question-php-download-upload-remote-mix/#findComment-319499 Share on other sites More sharing options...
Orio Posted August 9, 2007 Share Posted August 9, 2007 If you have "fopen wrappers" enabled, you can simply use copy(): <?php copy("www.some-domain.com/file.rar", "file.rar"); ?> Orio. Quote Link to comment https://forums.phpfreaks.com/topic/64106-hard-question-php-download-upload-remote-mix/#findComment-319517 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.