The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Fileman::fullbackup - xml-api?

Discussion in 'cPanel Developers' started by hbidad, Jun 17, 2010.

  1. hbidad

    hbidad Well-Known Member

    Joined:
    Apr 16, 2005
    Messages:
    74
    Likes Received:
    1
    Trophy Points:
    8

    Can this be called through the xml-api? I've been testing by sending a backup over FTP. It seems it is not listening to the dest and generates the backup to the users directory without attempting to establish a FTP connection.
     
  2. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Yes, you can use the xml-api to perform this API1 call.

    Here's an example in PHP that uses the xmlapi client class found here:
    http://sdk.cpanel.net/lib/xmlapi/php/cp_xmlapi_php_v1.0.5.tar.gz

    Code:
    
    $source_server_ip = "10.1.1.1";
    $cpanel_account = 'mycpacct';  //will need for the API1 call
    
    $xmlapi = new xmlapi($source_server_ip);
    $xmlapi->password_auth("root","r00tS3cret!");
    $xmlapi->set_port('2087');
    
    // alternatively, you could login as a regular
    //  cpanel account for this call instead of root
    //$xmlapi->password_auth($cpanel_account,"cP4nelS3cret!");
    //$xmlapi->set_port('2083');
    
    //credentials for the remote backup server
    $remote_ftpacct = 'remoteftpAcct';
    $remote_ftppass = 'ftpS3cret!';
    
    $api_args = array( 
                               'ftp',                        // destination type
                               '10.1.1.2',                // destination address
                               $ftpacct,                 // ftp user
                               $ftppass,                // ftp password
                               'me@myweb.test',    // email to notify
                                21,                       // port
                                '/'                        // remote path to put file
                             );
    
    
    $xmlapi->api1_query($cpanel_account,'Fileman','fullbackup',$api_args);
    
    Let me know if you need more assistance, I'd be glad to help.

    Regards,
    -DavidN
     
  3. tomdchi

    tomdchi Well-Known Member

    Joined:
    Feb 24, 2008
    Messages:
    116
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Atlanta, GA
    cPanel Access Level:
    DataCenter Provider
    I am using the script posted above and it works great on one server but on another server ftp fails. I get the error:

    Code:
    Net::FTP>>> Net::FTP(2.77)
    Net::FTP>>>   Exporter(5.58)
    Net::FTP>>>   Net::Cmd(2.29)
    Net::FTP>>>   IO::Socket::INET(1.29)
    Net::FTP>>>     IO::Socket(1.29)
    Net::FTP>>>       IO::Handle(1.25)
    Net::FTP=GLOB(0x10706ed8)<<< 220 Microsoft FTP Service Net::FTP=GLOB(0x10706ed8)>>> USER backup.paytracs.com|backup Net::FTP=GLOB(0x10706ed8)<<< 331 Password required for backup.paytracs.com|backup.
    Net::FTP=GLOB(0x10706ed8)>>> PASS ....
    Net::FTP=GLOB(0x10706ed8)<<< 230 User logged in.
    Net::FTP=GLOB(0x10706ed8)>>> TYPE I
    Net::FTP=GLOB(0x10706ed8)<<< 200 Type set to I.
    Net::FTP=GLOB(0x10706ed8)>>> CWD \
    Net::FTP=GLOB(0x10706ed8)<<< 250 CWD command successful.
    Cannot open Local file : No such file or directory  at /usr/local/cpanel/bin/ftpput line 34 Net::FTP=GLOB(0x10706ed8)>>> QUIT Net::FTP=GLOB(0x10706ed8)<<< 221 Goodbye.
    
    
    Anyone know how to fix this?
     
  4. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    hmm, that call should work regardless of system (as long as server is cPanel 11.24.5 or greater). The last line indicates that your server is missing some essential cPanel files.

    The best suggestion I can offer is to open a support ticket; https://tickets.cpanel.net/submit/ . They'll be able to confirm the integrity of your cPanel installation. As well, if I'm totally wrong, they can help determine the aberrations that are causing that API request to fail.

    -DavidN
     
Loading...

Share This Page