What is the best way to move files from one server to another with PHP?

user4903 picture user4903 · Oct 28, 2008 · Viewed 8.9k times · Source

I want to setup a CRON that runs a PHP script that in turn moves XML file (holding non-sensitive information) from one server to another.

I have been given the proper username/password, and want to use SFTP protocol. The jobs will run daily. There is the potential that one server is Linux and the other is Windows. Both are on different networks.

What is the best way to move that file?

Answer

Alexandru Luchian picture Alexandru Luchian · Oct 28, 2008

If both servers would be on Linux you could use rsync for any kind of files (php, xml, html, binary, etc). Even if one of them will be Windows there are rsync ports to Windows.