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.

display result of creation of account

Discussion in 'cPanel Developers' started by danielati, Jan 12, 2012.

  1. danielati

    danielati Active Member

    Joined:
    Nov 7, 2011
    Messages:
    31
    Likes Received:
    1
    Trophy Points:
    6
    cPanel Access Level:
    Website Owner
    Hi,
    I'm using xmlapi class to create account. And it works. But I don't have a result if the account was created or not.
    How can I make this condition?

    I'm passing the values ​​as follows:
    $acct = array( username => "test", password => "#@]87G", domain => "test.domain.com");
    print $xmlapi->createacct($acct);

    Thanks
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
  3. danielati

    danielati Active Member

    Joined:
    Nov 7, 2011
    Messages:
    31
    Likes Received:
    1
    Trophy Points:
    6
    cPanel Access Level:
    Website Owner
    So David .... the account is being created, but I do not have an output as the link you provided.
    I don't know what happen.....
     
  4. danielati

    danielati Active Member

    Joined:
    Nov 7, 2011
    Messages:
    31
    Likes Received:
    1
    Trophy Points:
    6
    cPanel Access Level:
    Website Owner
    The status is lost in this part of the function xmlapi_query:

    Code:
    // perform simplexml transformation (array relies on this)
    		if ( ($this->output == 'simplexml') || $this->output == 'array') {
    			[COLOR="#FF0000"]$response = simplexml_load_string($response, null, LIBXML_NOERROR | LIBXML_NOWARNING);[/COLOR]
    			if (!$response){
    			        error_log("Some error message here");
    			        return;
    			}
    			if ( $this->debug ) {
    				error_log("SimpleXML var_dump:\n" . print_r($response, true));
    			}
    		}
    
    After that $response is empty;

    My $this->output is 'simplexml'
     
    #4 danielati, Jan 12, 2012
    Last edited: Jan 12, 2012
  5. danielati

    danielati Active Member

    Joined:
    Nov 7, 2011
    Messages:
    31
    Likes Received:
    1
    Trophy Points:
    6
    cPanel Access Level:
    Website Owner
    Hi guys!!!
    I've solved the problem....
    I added the following line in the condition mentioned in the above post:
    echo $response->result->statusmsg;

    Thanks
     
  6. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    PHP is letting you know the data type of that variable. That's why ->result->statusmsg works - because you are accessing that data structure, you could also use ->result->status for a raw result on success or failure rather than assuming an empty string for success.
     
  7. danielati

    danielati Active Member

    Joined:
    Nov 7, 2011
    Messages:
    31
    Likes Received:
    1
    Trophy Points:
    6
    cPanel Access Level:
    Website Owner
    I understand. And I thank for the tip.:)
     
Loading...

Share This Page