webtec

Member
Apr 18, 2002
7
0
301
Does anyone know how I can automate subdomain creation using Cpanel scripts? Is it even possible?

I would like to setup a form to collect user and payment information for the subscriber so they can create a subdomain upon payment. I tried doing the same as what is being done in cpanel subdomain's index.html page but I'm having permission problems.

Is there a way I can set it up so my users can create their own subdomains upon c.c. acceptance?

This is what I'm using to try to create the subdomain:
&cpanel SubDomain=&addsubdomain($FORM{'domain'})&&
Is this correct?

Thank you,
wthCJ ;)
 

nsolent

Registered
Sep 5, 2002
4
0
151
yes

I'm also interested in the same type of thing.
Althought I'm guessing I could wing it with CURL... theres got to be a better way though.
 

webtec

Member
Apr 18, 2002
7
0
301
with PHP

I'm want to do this through PHP. What are you using to attempt this? PHP? Perl?
 

nsolent

Registered
Sep 5, 2002
4
0
151
PHP is my flavor of choice.
maybe this will give you some ideas:


//I wrote this PHP to retrieve Bandwidth info from my cPanel4 page and email me (and others)
//each subdomain's bandwidth and the total bandwidth for the current month
//All this because there isn't a public stats page in cpanel
//also note that cpanel doesn't update this subdomain stats page very often

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,&http://yourusername:yourpassword@yourdomain.com:2082/frontend/power/stats/bandwidth.html&);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$result=curl_exec ($ch);
curl_close ($ch);

//$result has the whole stats page; I find what i need in it and email it to myself.
//subdomain creation would be about the same.. except you'd be submitting the subdomain name to the form that's in cpanel
//I can send you a whole example of this email thing if you want...
//perhaps later i'll post the subdomain creation if i ever do it, but right now i'm checking out this nixt.org script for reselling full accounts from whm