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!

XML-API: List all domains on a server along with their assigned IP

Discussion in 'cPanel Developers' started by stards, Jan 12, 2014.

  1. stards

    stards Registered

    Joined:
    Jan 11, 2014
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi

    Is there a way to list all domains on a server along with their cpanel-assigned IP? I know there's "resolvedomainname?api.version=1&domain=example.com" but this one does a DNS resolve (not a straight out pull from the cpanel server itself like httpd.conf).

    I'd hate to have to pull info out of vhosts from httpd.conf.

    There's this perl module:

    /usr/local/cpanel/Cpanel/UserDomainIp.pm

    Is there way to leverage this piece of code reliably without it breaking in the future? If so what's the proper way to pull the info out?

    Please help!

    Thanks
     
  2. KostonConsulting

    KostonConsulting Well-Known Member

    Joined:
    Jun 17, 2010
    Messages:
    255
    Likes Received:
    1
    Trophy Points:
    68
    Location:
    San Francisco, CA
    cPanel Access Level:
    Root Administrator
    You'd think so but frustratingly, something so simple is not available. There's listaccts (List Accounts) which will show the primary domain and IP for each account but it does not provide sub/parked/addon domains.

    The only place in the UI that shows all domains and their IPs is https://<hostname>:2087/cpsessXXXXXX/scripts/ipusage

    You could parse this page for the information.

    You could also write your own custom API module to gather this data: Writing cPanel Modules



    You could write a custom API module that is a wrapper around UserDomainIP::getdomainip(). However, there's no guarantee that this function won't change in the future (though it hasn't in a long time).

    Custom API module docs: Writing cPanel Modules
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. stards

    stards Registered

    Joined:
    Jan 11, 2014
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator

    Thanks! At the very least now I have a sense of direction...
     
  4. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,167
    Likes Received:
    1,933
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Note that you are also welcome to open a feature request to see a more direct way of obtaining this information through our API:

    Submit A Feature Request

    Thank you.
     
    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