I have an Apache server running on a client’s computer, with PHP installed. I have scheduled a task to automatically create a database backup, and it’s working fine. But it makes no sense keeping the backups on the same HD the system’s running, so I have to send it somewhere else.
At first, I tried doing a PHP FTP Upload, but the client’s firewall’s blocking all FTP connections, and I cannot unblock it (his company won’t allow me).
Then, I tried sending the backup using SMTP, to an e-mail account. Also didn’t work. All SMTP connections are also blocked (I know…).
I’m trying now to access a webpage (on my server), via a HTTP POST REQUEST, with the file attached on the page-header. It should be possible, seeing that’s pretty much what the browser does, with a file-input object, right? I just sends the multipart/data using the page header.
Will I have to create the page header manually? Or are there any scripts that already do that?
You can use curl to send it via http. Assuming your file is ‘/tmp/backup.tar.gz’, it’d be:
That’s the basics. you’d probably need to make it a bit more robust. Assuming the upload script on the receiving server is done in php, you’d access the file as
$_FILES['file'].