suzana
suzana

Reputation:

A script to get files from the net

I own a website and I wonder if there is a script that get files for me from other links on the net a load it to my server.

Suppose I found a file with a size of 400 mb, I want to host it on my server. The normal way I used is to download the file to my pc then upload it to my server but is there a script or a way to transfer and host the file directly without downloading it.

Upvotes: 0

Views: 221

Answers (4)

PhiLho
PhiLho

Reputation: 41132

I think FTP protocol supports server to server transfer.

Upvotes: 0

UnkwnTech
UnkwnTech

Reputation: 90851

As long as you have PHP use:

<?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);
?>

Upvotes: 1

Neitherman
Neitherman

Reputation: 77

If you can remote into your server you could just navigate to the web page containing your download from within the server and save it directly to the server that way.

Upvotes: 0

wopwop
wopwop

Reputation:

wget from your server.

Upvotes: 1

Related Questions