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.

List accounts with php

Discussion in 'cPanel Developers' started by DavidS, Aug 14, 2009.

  1. DavidS

    DavidS Member

    Joined:
    Aug 14, 2009
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    I have been looking to find out how to list accounts with php outside of cpanel

    and i am having a bit of a issue
    PHP:
    $site "http://{$whmuser}:{$whmpass}@localhost:2086/scripts2/listaccts?viewall=1&nohtml=1";
    $result file_get_contents($site);
    $breakresult explode(","$result);

    foreach (
    $breakresult as $key){ // Split the cPanel Function array into bits. 
    echo $key;
    }
    that dont seem right to me. how can i list accounts in a table out side of cpanel/whm?
     
  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
    I would use the listaccts function in the XML API. We have documentation for that function at:

    ListAccounts < AllDocumentation/AutomationIntegration < TWiki

    However, if you are coding in PHP 5, we have a PHP 5 class you can use at:

    http://forums.cpanel.net/f42/xmlapi-php-class-111897.html
     
  3. DavidS

    DavidS Member

    Joined:
    Aug 14, 2009
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    i tryed that, and i am having a issue with puting that data into a table, and i am having another isue creating links, like make the domains in a link, and the emails, etc.
     
  4. 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
    If you are unfamiliar with programming in HTML and PHP, I recommend seeking tutorials on those topics. Searches on internet search engines helped me when I was learning about these topics.
     
  5. DavidS

    DavidS Member

    Joined:
    Aug 14, 2009
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    1
    i know about html and php, just not working with xml and inserting it into a table
     
  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
    You can find information about using XML in PHP by visiting: PHP: SimpleXML - Manual

    To echo data into a table, be sure to echo/print the information in PHP within the relevant <table>/<td> HTML tags.
     
Loading...

Share This Page