Page 1 of 1

Download a remote file to a server

Posted: Sat Aug 04, 2007 2:46 pm
by dmcewan
I have medium level of PHP skill, and I was wondering if anybody has any opinions of the best way to just download a remote file to a php server. If for example someone passed a URL of "http://localhost/dl.php?www.anywhere.co ... oc.torrent" what would be the best way (in PHP) for the server to save that torrent file from the remote location to a local directory on the server.

Thanks in the advance for even reading this post!

== David

Posted: Sat Aug 04, 2007 2:51 pm
by volka
e.g.

Code: Select all

$s = fopen($url, 'rb');
file_put_contents('localfile.name', $s);

Posted: Sun Aug 05, 2007 2:17 pm
by themasterofthedisaster
Bittorrent in PHP. Greate idea! But is it possible to build such a PHP program???

Posted: Sun Aug 05, 2007 2:38 pm
by John Cartwright
themasterofthedisaster wrote:Bittorrent in PHP. Greate idea! But is it possible to build such a PHP program???
There are a couple php clients out there, dig around.

Thanks

Posted: Sun Aug 05, 2007 3:44 pm
by dmcewan
I'm actually just trying to create a little script that will kick off a download on a windows machine. I'll post the code once I get it up.

Posted: Sat Aug 11, 2007 12:21 pm
by themasterofthedisaster
Lol, PHP P2P, sounds gretate. Here I have found some info: http://www.vclcomponents.com/PHP/File_M ... -info.html
Ill continue searching...