The following script does just this:
<?php
// your cPanel username
$cpanel_user = '<username>';
// your cPanel password
$cpanel_pass = '<password>';
// your cPanel skin
$cpanel_skin = 'x3';
// your cPanel domain
$cpanel_host = '<domain name>';
// subdomain name
$subdomain = '<subdomain name>';
// create the subdomain
$sock = fsockopen($cpanel_host,2082);
if(!$sock) {
print('Socket error');
exit();
}
$pass = base64_encode("$cpanel_user:$cpanel_pass");
$in = "GET /frontend/$cpanel_skin/subdomain/doadddomain.html?rootdomain=$cpanel_host&domain=$subdomain\r\n";
$in .= "HTTP/1.0\r\n";
$in .= "Host:$cpanel_host\r\n";
$in .= "Authorization: Basic $pass\r\n";
$in .= "\r\n";
fputs($sock, $in);
while (!feof($sock)) {
$result .= fgets ($sock,128);
}
fclose($sock);
echo $result;
?>
Great explanation about the topic Please keep sharing more and more information.Thanks
ReplyDeleteDomain registration