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.

cPanel API Access denied - Backup

Discussion in 'cPanel Developers' started by saulyx, Apr 17, 2012.

  1. saulyx

    saulyx Member

    Joined:
    Apr 7, 2007
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    Hi there,

    I'm trying to make a backup via the API, however the WHM doesn't have the API enabled(somehow yet I can retrieve the account list when I use a different class just for whm?)

    Here is my code(values replaced with dummy ones)

    PHP:
    $xmlapi = new xmlapi("111.11.11");
    $xmlapi->password_auth("cpanel user(not root)","password");
    $xmlapi->set_http_client('curl');
    $xmlapi->set_port("2083");
    $xmlapi->set_debug(1);
                    
    $api_args = array( 
                
    'ftp',                        // destination type
                
    '11.22.33',                // destination address
                
    'a123',                 // ftp user
                
    'p123',                // ftp password
                
    's@gmail.com',    // email to notify
                
    21,                       // port
                 
    '/'                        // remote path to put file
                
    );
                    
                    
    $xmlapi->api1_query("a123",'Fileman','fullbackup',$api_args);
    Anyone could explain to me why I'm getting the following stack?


    Anyone could help? This is urgent
     
  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
    Hi saulyx,

    the "cpanel user(not root)" value is the same as your "a123", right? If you connect to port 2083, you must authenticate as the user you are affecting. If you're trying to authenticate as a reseller and perform actions as one of the resellers cPanel accounts, use port 2087.

    Regards,
    -DavidN
     
  3. saulyx

    saulyx Member

    Joined:
    Apr 7, 2007
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    Thank you for your reply, yes a123 is same as the one you mentioned, that's the weird thing as I can log into cpanel with that info but can't via API.. those credentials are also for the reseller(which at later date they won't be),


    Any other ideas you may have?



    Thanks,
    S
     
  4. saulyx

    saulyx Member

    Joined:
    Apr 7, 2007
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    Right so what I've discovered is that it just doesn't connect to the server at all. If I switch to 2087, it works.. If I switch to 127.0.0.1 I get access denied but at least it returns the XML.. So I moved the script to my localhost, and 2083 worked just fine..

    I'm guessing it's server blocking it? Any ideas?

    As for the atual backup being uplaoded, I only got a file called "cpbackup-exclude.conf" in the FTP?


    Thanks,
    S
     
Loading...

Share This Page