Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Aug 2010
    Location
    Venezuela
    Posts
    1

    Default Help please :( The class does not work

    I have tried all, put all and nothig i used this class xmlapi and it did not work, it did not show a mistake but it did not do anything, I want to create a instantly subdomain with this class but i haven´t been able to.. please help.. i used this:
    PHP Code:
    <?php
    include("xmlapi.php");
    $ip "127.0.0.1";
    $account "username";
    $password "passoword";

    $xmlapi = new xmlapi($ip);
    $xmlapi->password_auth($account,$password);
    $xmlapi->set_port('2082');

    $args = array(
      
    domain=> "subdomain"
      
    rootdomain=> "domain",
      
    dir => "public_html/"
    ); 

    $xmlapi->set_debug(1);
    print 
    $xmlapi->api2_query($account"SubDomain""addsubdomain"$args );
    ?>
    with xmlapi but it did not work, what is it happening? , maybe is it the IP? what IP is that? i do not get that i keep like that..
    Last edited by jgames88; 08-26-2010 at 08:23 AM.

  2. #2
    Integration Developer cPanelDavidN's Avatar
    Join Date
    Dec 2009
    Location
    Houston, TX
    Posts
    525

    Default

    Hi jgames88,

    The code example you provided should work fine as far as creating the subdomain. However, there's one technical error that I'm surprised didn't throw a warning. The query methods ("xmlapi_query", "api1_query", and "api2_query") all return a SimpleXML object by default. So, in you last line you're using a "print" statement on an object, which is likely to fail in this particular case. If you want to see the results, as a whole, either do "var_dump($result)" or "print $result->asXML()" or "echo $result->asXML()"

    The variable "$ip" is the IP address of the machine that hosts your account. If you're invoking you script on the server that has you account, you can leave it with '127.0.0.1'. That particular address is a loopback; it just points to the localhost, e.g. the server you're on.

    What is the exact output of that? If you're invoking that code on a cPanel box, the debug output is likely going to the cPanel error_log. If you're running on a non-webserver, say like your laptop of PC, the debug messages will likely just be printed to the screen (STDOUT).

    Do you have access to the cPanel error log? It's located at /usr/local/cpanel/logs/error_log. That might yield some information other than debugging from the class; some system warnings, etc.

    Need to make sure you have cURL or have fopen wrappers that can stream the request, but unless you're in a restrictive environment, fopen should be there and available by default.

    Have you tried to execute a call that just fetches information?
    try something like StatsBar::stat
    Code:
    // you setup code here
    
    $args = array( 'display' => 'phpversion|emailaccounts') ;
    $result = $xmlapi->api2_query($account, "StatsBar", "stat", $args);
    
    var_dump($result);
    That code should render info related to you PHP version and how many POP email accounts you have,
    Code:
    // example snippet of output //
    
    SimpleXMLElement Object
    (
        [apiversion] => 2
        [data] => Array
            (
                [0] => SimpleXMLElement Object
                    (
                        [name] => phpversion
                        [_maxed] => 0
                        [count] => SimpleXMLElement Object
                            (
                            )
    
                        [id] => phpversion
                        [item] => PHP version
                        [langkey] => INDXPHPver
                        [max] => SimpleXMLElement Object
                            (
                                [0] =>  
                            )
    
                        [module] => Serverinfo
                        [percent] => 0
                        [percent10] => 0
                        [percent20] => 0
                        [percent5] => 0
                        [value] => 5.2.9
                    )
    
                [1] => SimpleXMLElement Object
                    (
                        [name] => emailaccounts
                        [_count] => 2
                        [_max] => unlimited
                        [_maxed] => 1
                        [count] => 2
                        [feature] => popaccts
                        [id] => emailaccounts
                        [item] => Email Accounts
                        [langkey] => INDXEmailAccounts
                        [max] => unlimited 
                        [module] => Email
                        [percent] => 0
                        [percent10] => 0
                        [percent20] => 0
                        [percent5] => 0
                        [zeroisunlimited] => 0
                    )
            )
    )

    Regards,
    -DavidN
    David Neimeyer
    Integration Developer

    sdk.cpanel.net
    APIs: XML-API API1 & API2
    Check Out: Developer Downloads Integration Blog
    Need Support? Support Ticket Developer Forum Feature Request

Similar Threads & Tags
Similar threads

  1. php COM class problem
    By cloudtemple in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 06-24-2011, 08:10 AM
  2. can I use this class or its too old ?
    By quecoder in forum cPanel Developers
    Replies: 1
    Last Post: 07-22-2010, 12:53 PM
  3. Python Class
    By damianz in forum cPanel Developers
    Replies: 0
    Last Post: 06-13-2009, 05:32 PM
  4. Multiple Class C IP's
    By Pjotr in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 06-11-2003, 12:48 PM
  5. Tomcat class file where to...
    By juzthost in forum cPanel and WHM Discussions
    Replies: 8
    Last Post: 12-09-2002, 07:36 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube