Created
October 25, 2015 06:47
-
-
Save gizalink/34778d75fd98a827f429 to your computer and use it in GitHub Desktop.
Auto Backup Cpanel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
cPanel Backup Script | |
Author: Xeroday | |
*/ | |
$auth = base64_encode("userhost:passhost"); | |
$domain = "chi16.stablehost.com"; | |
$theme = "paper_lantern"; | |
$secure = true; | |
$ftp = false; | |
$ftpserver = ""; | |
$ftpusername = ""; | |
$ftppassword = ""; | |
$ftpport = "21"; | |
$ftpdirectory = "/"; | |
if ($secure) { | |
$url = "ssl://" . $domain; | |
$port = 2083; | |
} else { | |
$url = $domain; | |
$port = 2082; | |
} | |
$socket = fsockopen($url, $port); | |
if (!$socket) { | |
exit("Failed to open socket connection."); | |
} | |
if ($ftp) { | |
$params = "dest=ftp&server=$ftpserver&user=$ftpusername&pass=$ftppassword&port=$ftpport&rdir=$ftpdirectory&submit=Generate Backup"; | |
} else { | |
$params = "submit=Generate Backup"; | |
} | |
fputs($socket, "POST /frontend/" . $theme . "/backup/dofullbackup.html?" . $params . " HTTP/1.0\r\n"); | |
fputs($socket, "Host: $domain\r\n"); | |
fputs($socket, "Authorization: Basic $auth\r\n"); | |
fputs($socket, "Connection: Close\r\n"); | |
fputs($socket, "\r\n"); | |
while (!feof($socket)) { | |
$response = fgets($socket, 4096); | |
echo $response; | |
} | |
fclose($socket); | |
?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment