I am currently facing a rather limited shared web host that I have to (read: want to) work with to transfer files from FTP to FTP.
Server1: A dedicated linux server, full control (SSH etc.). Server2: A limited shared web host, but FTP enabled. Server3: A very limited shared web host, but also FTP enabled.
What I need to 开发者_C百科get done is copy files from Server2 to Server3. Server 3 has nearly all PHP file transfer options disabled, but FTP enabled. My only option is to transfer the files using FTP. The first thing that springs to mind is;
-Server1 imports files from server2 using wget (with php exec):
exec('wget ftp://user:pass@server2.com//home/filesfolder/thefile.php -P /var/www/holdingfolder');
-Server1 uploads the file to server3 using FTP and removes it from "holdingfolder"
This works, but this option is just a waste of bandwidth and assumes that server1 at all times has enough space available to hold the file until it's transferred. Can't I just FTP it directly to the other FTP server using the dedicated linux server's FTP client as a, well, puppet master?
FTP isn't intended to be a proxy system - it's point-to-point only. However, since both the ftp-only systems are webhosts, can't you install a PHP script on either server to do the server2<->server3 transfers directly? You could invoke that via wget from server1, and basically tell the other servers "ftp to the other server and fetch file X".
精彩评论