Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

XML API 2 help

Discussion in 'cPanel Developers' started by Dragonxito, May 13, 2011.

  1. Dragonxito

    Dragonxito Registered

    Joined:
    May 13, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    51
    What is wrong here? Thanks in advance

    Code:
    <?php
    require_once('xmlapi.php'); 
    
    $ip = 'www.mydomain.com';
    $account = 'cp_user';
    $pass = 'cp_password';
    
    $xmlapi = new xmlapi($ip);
    $xmlapi->password_auth($account,$pass);
    $xmlapi->set_output("json");
    
    $xmlapi->set_debug(1);
    print $xmlapi->api2_query($account, 'SubDomain','addsubdomain', array('dir'=>'/public_html/subdomain/','disallowdot'=>1,'domain'=>'subdomain','rootdomain'=>'www.mydomain.com'));
    ?>
     
  2. MattDees

    MattDees Well-Known Member

    Joined:
    Apr 29, 2005
    Messages:
    416
    Likes Received:
    1
    Trophy Points:
    243
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    If you are using a user's credentials and not root, you need to do an $xmlapi->set_port(2083); before you attempt the query.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice