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.

how to get the cpanel account details hosting a site

Discussion in 'General Discussion' started by bryan.kewl, Feb 23, 2011.

  1. bryan.kewl

    bryan.kewl Member

    Feb 23, 2011
    Likes Received:
    Trophy Points:

    I have many sites hosting under cpanel/WHM on a VPS, now I need to get the cpanel account details within a script. Lets say I have following cpanel accounts


    account1 is hosting sites site1.tld, site2.tld, site3.tld and site4.tld
    account2 is hosting sites site5.tld, site6.tld, site7.tld and site8.tld
    (more sites can be added from cpanel accounts so I can't hard code the site-cpanel relation in my script)

    now lets say I have a script scpt1.php available on all sites, so when someone access the script against any site, I need to know which cpanel account is hosting the site.
    e.g. when someone opens site1.tld/scpt1.php it should say account1 and for site6.tld/scpt1.php the answer should be account2

Share This Page