<?php
 
    require("exportDb.php"); //the class file exportDb
 
    
 
    $server = "localhost:3306";    //Port is not really necessary
 
    $username = "user";        //Username for MySQL server    
 
    $password = "pass";            //Password for MySQL server
 
    
 
    $e = new exportDb($server, $username, $password);
 
    $myFile = $e->getFilename();    // getting file name
 
    $e->backup(); // runing the backup
 
    $e->close(); // close the mysql connection
 
    unset($e); 
 
 
    //transfer file to another server
 
    $FTP_HOST ="ftp.server.com";
 
    $FTP_USER ="ftp_user";
 
    $FTP_PW   ="ftp_pass";
 
    $FTP_ROOT_DIR="/public_html/db_backup/"; //to the folder the the file will be upload.
 
 
    $mode = FTP_ASCII; 
 
    $conn_id = ftp_connect($FTP_HOST);
 
    if(ftp_login($conn_id, $FTP_USER, $FTP_PW))
 
    {
 
        ftp_pwd($conn_id);     
 
        ftp_pasv ( $conn_id, true );                 
 
        ftp_chdir($conn_id,$FTP_ROOT_DIR);
 
        ftp_pwd($conn_id);              
 
        
 
        $from = fopen($myFile,"r");    
 
        
 
        if(ftp_put($conn_id, $myFile, $myFile, $mode))
 
        {
 
           
 
        }
 
        fclose($from);        
 
    }
 
    ftp_quit($conn_id);
 
    
 
?>
 
 |