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.

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:
    1
    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 cPanel Product Owner
    Staff Member

    Joined:
    Apr 29, 2005
    Messages:
    417
    Likes Received:
    1
    Trophy Points:
    18
    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.
     
Loading...

Share This Page