Jump to content

Copy file from remote Server to another Remote Server


adhossain

Recommended Posts

I want to use a php script so that when I access the page, the browser copy the file from server to another server. Say, a file is in www.google.com/file.exe and when I open the page, the file will be copied to www.myserver.com/download location. pls tell me indetails coz I know only a little about PHP.Thanks

Link to comment
Share on other sites

You can use file_get_contents() to get a remote file then you can use file_put_contents() to write to second server where the script will run. Second server must have url file open option in php.ini on

Link to comment
Share on other sites

I haven't actually tried this, but I believe you should be able to do things with just copy(), like:

copy('http://www.google.com/file.exe', 'ftp://user:pass@www.myserver.com/download/file.exe');

(assuming "user" and "pass" are adjusted to your actual credentials for your FTP server that should be running on www.myserver.com)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...