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.

Issue with using the createacct($acct) function for creating domains

Discussion in 'cPanel Developers' started by sachintaware, Mar 28, 2013.

  1. sachintaware

    sachintaware Member

    Joined:
    Jan 29, 2013
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Hello folks,
    I am working on an application that allows users to log in and create their own domains by selecting a relevant domain name.I went through the docs and studied the use of cpanel API class and functions.I worked with the createacct($acct) function and got it working,but I have some issues with its working.
    1) When I try to create a domain with some name,the API fails to create one,but instead if I try the same using WHM panel it creates a domain with that name.For eg: I tried using a name nageshtest,I was not able to create it and if I try the same with WHM it worked.What must the issue with it or am I doing something silly?I believe only if the domain is already present it should be disallowed(ofcourse I am taking care of not entering special characters).So,what can be the issue?
    2) When I create a account I get a long message saying Your account has been created successfully and when it fails it returns the details with the error message.How could I get a true or false based message or only the error code or text,so that I can display it to the user ?

    Adding my code for reference:

    PHP:
     $xmlapi->set_debug(1);

     
    $acct = array( 'username' => $userName'password' => $password'domain' => $domain);

     
    $createAccount$xmlapi->createacct($acct);
     
    //print_r($createAccount);
     
    if(strpos($createAccount,'Account Information')===false)
        { 
            echo 
    "Your domain has not been created";
            echo 
    $createAccount;        
        }
    else{
            echo 
    "Your domain has been created successfully";
       }
    The variable createAccount returns a long text,but I need something like true false or an error code.
    I believe I am clear enough to get some help!

    Thank you
     
    #1 sachintaware, Mar 28, 2013
    Last edited: Mar 28, 2013
Loading...

Share This Page