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.

Question about API's

Discussion in 'cPanel Developers' started by AlexVB, Jul 10, 2013.

  1. AlexVB

    AlexVB Member

    Joined:
    Oct 23, 2007
    Messages:
    13
    Likes Received:
    1
    Trophy Points:
    1
    I am writing some perl application which needs to get:

    1) all domains that are accesible from web (including sub-domains, parked domains, addon domains, etc)
    2) ip address to which user's domains are mapped to

    for each cpanel user.

    Which API i need to use for that purpose?

    This application will work locally on the cpanel server.

    Thanks
     
  2. KostonConsulting

    KostonConsulting Well-Known Member

    Joined:
    Jun 17, 2010
    Messages:
    255
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    San Francisco, CA
    cPanel Access Level:
    Root Administrator
    You should be able to use DomainLookup::getdocroots() and DNSLookup::name2ip() for these purposes. One should note that cPanel will output duplicate data for addon domains.

    For example, domain1.com is your main domain on the account. You add domain2.com as an addon domain. When outputting all the domains, you get an entry for domain2.com as well as the subdomain alias domain2.domain1.com. I've found it necessary to remove this subdomain alias from anything that is shown to customers as it can cause a lot of confusion.

    You can use the cPanel LiveAPI Perl module interface if you're going to have cPanel users directly interacting with the script via URL:

    LiveAPI — Perl
     
Loading...

Share This Page