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 of subdomains

Discussion in 'cPanel Developers' started by QuadRoM, Oct 4, 2012.

  1. QuadRoM

    QuadRoM Registered

    Joined:
    Oct 4, 2012
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    How can i get list of all subdomains using XML api?
    Subdomains can be listed "Domain, User, Subdomain, Addon/Parked Domain" at WHM.
     
  2. skyd

    skyd Member

    Joined:
    Sep 6, 2012
    Messages:
    6
    Likes Received:
    1
    Trophy Points:
    3
    cPanel Access Level:
    Website Owner
  3. QuadRoM

    QuadRoM Registered

    Joined:
    Oct 4, 2012
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    These functions only return results for a specified user. I tried them with 'root' user but they didn't work.
    I must be able to get all sub domains.

    I need a list like 'List Subdomains' page at web host manager. I don't know how that page works.
     
  4. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello,

    You may need to do it this way instead:

    http://forums.cpanel.net/f5/list-all-domains-96649.html#post435237

    Where you loop through the accounts and get a list of the subdomains or addon domains.

    Otherwise, in command line without using the API, you could do the following:

    Code:
    or i in `cat /etc/trueuserdomains | cut -d: -d' ' -f2-` ;do awk '/sub_domains/{c=5;next}c{c--;print}' /var/cpanel/userdata/$i/main ;done
    This won't show the files it is grabbing, though, to show the accounts. It is pulling the data from /var/cpanel/userdata/username/main where username is the cPanel username by reading the sub_domains portion of the file and returning the lines below it.
     
Loading...

Share This Page