Create a subdomain from a script

doors

New member
Joined
Jan 4, 2008
Messages
2
I got a script that adds a subdomain through a php script on my website. A portion of the script is below:


$request = "/frontend/$cpanel_skin/subdomain/doadddomain.html?rootdomain=$domain&domain=$subd";
$result = subd('localhost',2082,$cpaneluser,$cpanelpass,$request);
$show = strip_tags($result);
echo $show;


// create subdomain
function subd($host,$port,$ownername,$passw,$request) {

$sock = fsockopen('localhost',2082);
if(!$sock) {
print('Socket error');
exit();
}

$authstr = "$ownername:$passw";
$pass = base64_encode($authstr);
$in = "GET $request\r\n";
$in .= "HTTP/1.0\r\n";
$in .= "Host:$host\r\n";
$in .= "Authorization: Basic $pass\r\n";
$in .= "\r\n";

fputs($sock, $in);
while (!feof($sock)) {
$result .= fgets ($sock,128);
}
fclose( $sock );

return $result;
}


I need to know if direct admin could do something like this for me, where I can create a function that accepts my direct admin username, password, sub-domain name, domain name etc.?

I need to know urgently.

Thanks.
 
Back
Top