A script to get files from the network

I have a website and I am wondering if there is a script that gets files for me from other links on the web, uploading it to my server.

Suppose I found a 400mb file, I want to host it on my server. The usual way I've used is to download the file to my computer and then upload it to my server, but is there a script or a way to transfer and host the file directly without downloading it.

0
scripting web-applications download


source to share


4 answers


While you are using PHP:



<?php
$remotefh = fopen('http://domain.tld/path/to/file.ext', 'r'); 
$localfh = fopen('local/file.ext', 'w');
while(!feof($remotefh)) 
 {
    fwrite($localfh, fread($remotefh, '4096'));
 }
fclose($remotefh);
fclose($localfh);
?>

      

+1


source to share


wget from your server.



+1


source to share


If you can remotely to your server, you can simply go to the web page containing your download from the server and save it directly to the server.

0


source to share


I think FTP protocol supports server to server transfer.

0


source to share







All Articles
Loading...
X
Show
Funny
Dev
Pics