Location: PHPKode > scripts > Cpanel Backup scheduler > cpanel-backup-scheduler/cpanel.class.php
<?php	
	class CpanelBackup{
		var $cpaneluser; 
		var $cpanelpass; 
		var $domain; 
		var $skin = "x3"; 	//Cpanel skin name 
		var $ftpuser; 
		var $ftppass; 
		var $ftphost; 
		var $ftpmode = "ftp"; // FTP mode ("ftp" for active, "passiveftp" for passive)	
		var $NotificationEmail;	
		var $secure = 0; // Set to 1 for SSL (requires SSL support), otherwise will use standard HTTP	
		var $debug = 0; // Set to 1 to have web page result appear in your cron log
		
		
		
		function GetCpanelBackup(){
			
			if ($this->secure) {
			   $url = "ssl://".$this->domain;
			   $port = 2083;
			} else {
			   $url = $this->domain;
			   $port = 2082;
			}
			
			$socket = fsockopen($url,$port);
			if (!$socket) { echo "Failed to open socket connectionÂ… Bailing out!\n"; exit; }
			
			// Encode authentication string
			$authstr = $this->cpaneluser.":".$this->cpanelpass;
			$pass = base64_encode($authstr);
			
			$params = "dest=$this->ftpmode&email=$this->NotificationEmail&server=$this->ftphost&user=$this->ftpuser&pass=$this->ftppass&submit=Generate Backup";
			
			// Make POST to cPanel
			fputs($socket,"POST /frontend/".$this->skin."/backup/dofullbackup.html?".$params." HTTP/1.0\r\n");
			fputs($socket,"Host: $domain\r\n");
			fputs($socket,"Authorization: Basic $pass\r\n");
			fputs($socket,"Connection: Close\r\n");
			fputs($socket,"\r\n");
			
			// Grab response even if we don't do anything with it.
			while (!feof($socket)) {
			  $response = fgets($socket,4096);
			  if ($debug) echo $response;
			}
			
			fclose($socket);
		}
		
	}	
	
?>
Return current item: Cpanel Backup scheduler