Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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:
    51
    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 ?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,216
    Likes Received:
    10
    Trophy Points:
    313
    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:
    51
    cPanel Access Level:
    Root Administrator
    Yup, it comes under xml-api

    Thanks
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice