FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Download a file from remote server!





AOP Web Development
Hi, just need your inputs, hope you can share, i'm try to work a script which can download a file from a remote server directly to our server.. let say

from http://www.example.com/test.zip

i want to download the test.zip from the any remote site, and i want to download to my script.


Thanks!
kv
Code:

cp("http://www.example.com/test.zip", "<path on your server>");

easy Smile
fnds
PHP:
Code:
function get_remote_file($remote_file, $local_file){
    fwrite(fopen($local_file, "wb"), file_get_contents($remote_file));
}

// ex:
get_remote_file("http://www.example.com/file.zip", "file.zip");
get_remote_file("ftp://www.example.com/file.zip", "file.zip");
kv
fnds wrote:
PHP:
Code:
function get_remote_file($remote_file, $local_file){
    fwrite(fopen($local_file, "wb"), file_get_contents($remote_file));
}

// ex:
get_remote_file("http://www.example.com/file.zip", "file.zip");
get_remote_file("ftp://www.example.com/file.zip", "file.zip");


or just

Code:

cp("http://www.example.com/file.zip", "file.zip");
cp("ftp://www.example.com/file.zip", "file.zip");

Smile
sonam
Code:
cp("http://www.example.com/file.zip", "file.zip");


Are this cp function have any restriction with KB or MB in PHP. Any link with more inforamtions is welcome.

Sonam
AOP Web Development
thanks for your help it works now!
Related topics
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.