Thanks....
I'm looking for a script like that you've previously mentioned that will allow a cpanel like zipped mysql DB backup.
I've tried phpmyadmin for backing up plus lots of gzip and bzip2 scripts and whenever I test a recovery from these, the unzip process tells me the file is corrupt - but NOT when it's a cpanel backup, hence my interest... so at the moment I do a croned uncompressed ftp backup.
I'm not sure how cpanel do theirs, but it appears to be a different method to every other script I've used.
I've also been tested a more raw version of the script you have above, with the full backup line commented out and what I had hoped would do the mysql DB backup added, shown below, but it's a no go:
<?php
$target_host = 'currenthost';
$cpanel_userid = 'userid';
$cpanel_pass = 'thepassword';
$cpanel_theme = 'Xskin';
$ftp_host = 'ftp://myftpsite.com/httpdocs/backup/';
$ftp_user = 'mysite';
$ftp_pass = 'theftpsitepwd';
$email = 'admin@mysite.com';
//
// DO NOT ALTER ANYTHING BELOW THIS LINE
//
$user_pass = "$cpanel_userid:$cpanel_pass";
$authentication = base64_encode($user_pass);
$socket = fsockopen($target_host,2082);
if (!$socket) {
echo "$errstr ($errno)<br />\n";
} else {
// fputs($socket,"POST /frontend/$cpanel_theme/backup/dofullbackup.html?dest=ftp&email=$email&server=$ftp_host&user=$ftp_user&pass=$ftp_pass&submit=Generate Backup\r\n");
fputs($socket,"POST /getsqlbackup/DBname.gz?dest=ftp&email=$email&server=$ftp_host&user=$ftp_user&pass=$ftp_pass\r\n");
fputs($socket,"HTTP/1.0\r\n");
fputs($socket,"Host: $target_host\r\n");
fputs($socket,"Authorization: Basic $authentication \r\n");
fputs($socket,"Connection: close\r\n\r\n");
while (!feof($socket)) {
$request = fgets($socket, 4096);
}
echo 'Done.';
fclose($socket);
}
?>