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.

XMLAPI Class on Git Hub

Discussion in 'cPanel Developers' started by rmatakajr, Jul 26, 2011.

  1. rmatakajr

    rmatakajr Member

    Joined:
    Jun 8, 2011
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    Hey

    Im just starting to use the XMLAPI class on GitHub. Now I previoulsy wrote a
    class that would screen scrape, add domains, delete domains etc... This worked
    very well untill today where I got a

    ====
    The server was not able to find the document (./sql/addb.html) you requested.
    Please check the url and try again. You might also want to report this
    error to your web hosting provider.
    ====

    Well this was very sudden :( I was using multiple fsockopen calls to accomplish these
    cpanel tasks.

    Well i figured now is the time to switch to the XMLAPI .. but im very new to it and
    the issiue is i have over 400 users of a software right now that cant do anything :(
    because of this issue (cry)

    So I need to accomplish simple things like. Create a database, crate an addon domain
    etc... and I got to do this rather fast. So my big question is can I use the GitHub XMLAPI class
    to authenticate a users cpanel with there cpanel username and password then
    call these functions to add a domain a database, user etc..

    Any advise would be very awesome im in a bind here

    Thanks!
    Ricky
     
  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
    You can query a user's cPanel account via the xml-api PHP class.

    This is done by setting the port to 2083 and making API1/API2 calls:

    PHP:
    <?php

    include("../xmlapi.php");

    $account "someuser";
    $email_account "randomemail";
    $email_domain "somedomain.com";

    $xmlapi = new xmlapi($ip$account$password);
    $xmlapi->set_port(2083);

    print 
    $xmlapi->api2_query($account"Email""getdiskusage", array(domain=>$email_domainlogin=>$email_account) );
    For references of all the available api calls, please see the Api introduction on sdk.cpanel.net
     
Loading...

Share This Page