Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Jul 2009
    Posts
    2

    Default Check if an account already exists?

    How would i do that with the api?

  2. #2
    cPanel Staff cPanelMatt's Avatar
    Join Date
    Apr 2005
    Location
    Houston, TX
    Posts
    409

    Default

    There are numerous calls that would allow for performing that sort of function. The main one that I can think of off hand would be calling accountsummary with the potential user passed as an argument to it. If you need more info, I can help you out tomorrow.
    Matt Dees
    Integration Developer
    cPanel, Inc.
    cPanel Integration Blog

  3. #3
    Member
    Join Date
    May 2009
    Posts
    29

    Default

    ListAccounts < AllDocumentation/AutomationIntegration < TWiki

    Use that function with searchtype set as domain. You really need to start reading the documentation and stop asking silly questions in the forums
    Thanks, Luke Carrier
    edgeWeb - the cutting edge web host
    Free cPanel 11 hosting now available!

  4. #4
    Registered User
    Join Date
    Jul 2009
    Posts
    2

    Default

    I will try that out, thanks. One more thing, how can i check if a domain is being used by any user?




    Sorry for all the questions.

  5. #5
    Member
    Join Date
    Dec 2008
    Posts
    153

    Default

    This hasnt been tested, might work though.. 99% sure it will. as its just modified code I use.
    PHP Code:
    $exist false;
    $test_user "username";
    $str $xmlapi-> listaccts();
    $doc = new DOMDocument();            
    @
    $doc->loadHTML($str);        
    $s = @simplexml_import_dom($doc);
    $acct $s->body->listaccts->acct;
    foreach(
    $acct as $var => $value){
        
    $user     $value->user;
        if(
    $user == $test_user){
                   
    $exist true;
            }
    }
    if(!
    $exist){
    //user doesnt exist
    } else {
    //user does exist


Similar Threads & Tags
Similar threads

  1. Email Account disappeared, but still exists
    By stratasite in forum E-mail Discussions
    Replies: 4
    Last Post: 01-10-2009, 04:42 AM
  2. Creating an account when domain already exists
    By Fergo in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 12-09-2007, 11:11 PM
  3. Account exists but doesn't apear in Account List
    By sinjab in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 11-22-2007, 12:10 PM
  4. How do you check if a Subdomain exists?
    By ClearSky in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 11-20-2003, 05:52 PM
  5. check if user exists
    By anarckie in forum cPanel and WHM Discussions
    Replies: 10
    Last Post: 11-13-2002, 11:02 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube