I am wondering is it possible to create a PHP script to backup database on one server and then move the backup to an archive on the second totally different server.
So for example. A user access his/her online admin dashboard. In the list they have few sites lets say my-site-one.site and my-site-two.site. The user chooses to backup my-site-one.site so he or she click's a link which would use AJAX to trigger some sort of a file on there server and then run database backup.
Ones the database backup is done my-site-one.site sends the backup to my service where its securely stored under the user account.
This is probably will be a pain in the ass, but I can see few solutions.
- Have a PHP script with API Key and User Key provided to the user and then have the user put this onto there server.
- With my own site validate the PHP file along with API Key and User Key.
- Have the PHPfile on user server make a backup to a static directory lets say /db-backups-##########.
- With my site when command to backup is ran use CURL to check for /db-backups-########## and file located in it lets say db_dd-mm-yy_hh-mm.sql or .tar or .zip. With CURL fetch the file and store in on my own server.
Would this work or does anyone have a better idea how to do something like this? Or is it better to use PHP along with FTP?