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.

WHM API and Subdomains Question

Discussion in 'General Discussion' started by tectonic, Aug 12, 2006.

  1. tectonic

    tectonic Registered

    Aug 12, 2006
    Likes Received:
    Trophy Points:
    Hello cPanelers. I have reseller rights on my webhost, which gives me access to WHM. I've written a script in Perl that uses the WHM API to make new accounts, and this seems to work correctly. However, I'm having trouble figuring out how to do what I want to do, and so I'm hoping someone can offer some advice. Here is what I'd like to do:

    When someone registers at my site, I want to automatically create as a cpanel account. (I can do this now.) Then, perhaps immediately, or perhaps at a later date, I want to also let the user register a domain name through my eNom reseller account. At that time I'd like the domain name to become their site, and the original to point to the domain name. How do I do this through the API? Does parking a domain on their do this, or will that cause the parked domain to redirect traffic to the subdomain? I want their URL to be once they've registered it.

    I can make a new account with the domain '' and this works, but then how do I later give it it's own domain name through the API? Do I need to make a new account with the new domain name? How do I make a subdomain of my account and point it to their new domain? DNS zones?

    Any help would be greatly appreciated. I'm an experience Perl programmer, but I'm new to cPanel and WHM hosting.


  2. brianoz

    brianoz Well-Known Member

    Mar 13, 2004
    Likes Received:
    Trophy Points:
    Melbourne, Australia
    cPanel Access Level:
    Root Administrator
    I think parking a domain is sufficient, but I'm not sure there's an API hook for doing that.

    Parking a domain causes references to the domain to be forwarded transparently to the original However, will remain in the email addresses (perhaps as the default).

    The most thorough solution might be to recreate the account under the correct domain name.

    Regardless, the only way to script domain name parking is to simulate a post to the cpanel domain name parking page, and this is relatively easy -- there's code around that does it. It's not sufficient to modify the DNS zones as each account also has a httpd.conf entry which must be updated.

Share This Page