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.

How to list active cpanel accounts with API ?

Discussion in 'cPanel Developers' started by serverack, Jan 1, 2012.

  1. serverack

    serverack Member

    Joined:
    Aug 14, 2011
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi,
    I am making a whm plugin.
    I want to list out active accounts on cpanel server. How to do that ?
    Developers documentation got very very less data.
    I am using PHP and using for loop, I want to store their usernames in array.

    I googled and found listaccts is used but how to use it in PHP ?
     
  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
    The API you want to use here is the XML-API, not API1. API1 and API2 limit you to a single cPanel account, whereas the XML-API lets you do things that are generally done in WHM, like listing accounts. You don't need to pass any parameters to listacct unless you are searching for specific accounts.

    For information on how to call listaccts from the XML-API via PHP, I strongly recommend downloading looking that the sample PHP class linked to on sdk.cpanel.net which links to: https://github.com/CpanelInc/xmlapi-php
     
  3. serverack

    serverack Member

    Joined:
    Aug 14, 2011
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Yup, it comes under xml-api

    Thanks
     
Loading...

Share This Page