Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env php
- <?php
- $cpaneluser = 'cPanel user';
- $cpaneluserpass = 'cPanel pass';
- $theme = 'paper_lantern';
- $ftp = false;
- $ftpserver = 'localhost';
- $ftpusername = 'cPanel user';
- $ftppassword = 'cPanel pass';
- $ftpport = 'port of protocol using';
- $ftpdirectory = '/must/exist/or/will/fail';
- // Do not edit below this line
- $domain = 'localhost';
- $secure = true;
- $auth = base64_encode($cpaneluser . ":" . $cpaneluserpass);
- if ($secure) {
- $url = "ssl://" . $domain;
- $port = 2083;
- } else {
- $url = $domain;
- $port = 2082;
- }
- $socket = fsockopen('localhost', 2082);
- if (!$socket) {
- exit("Failed to open socket connection.");
- }
- if ($ftp) {
- $params =
- "dest=scp&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; //uncomment this line for debugging
- }
- fclose($socket);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement