WHM API and Subdomains Question

tectonic

Registered
Aug 12, 2006
1
0
151
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 theirname.mydomain.com 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 theirname.mydomain.com to point to the domain name. How do I do this through the API? Does parking a domain on their theirname.mydomain.com do this, or will that cause the parked domain to redirect traffic to the subdomain? I want their URL to be theirdomain.com once they've registered it.

I can make a new account with the domain 'theirname.mydomain.com' 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.

Thanks!

-Andrew
 

brianoz

Well-Known Member
Mar 13, 2004
1,146
7
168
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 www.theirdomain.com to be forwarded transparently to the original theirname.mydomain.com. However, theirname.mydomain.com 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.