I am thinking to make a code to add in my script (addmember.php) so that upon adding of members, it will go to CPANEL and call for the subdomain and redirect link and create the subdomain $username.domain.com and redirect to http://www.domain.com/username.

So far i am only to find out till this part:

http://username:password@domain.com:...ain/index.html
this link allows me to auto login to CPANEL and go to sub domain page.

Down below is the direct links code to create accounts in WHM

<?php

$url = "http://$hostusername:$hostpassword@$hostdomain:2086/scripts/wwwacct?plan=Custom%20Plan&username=$username&password=$password&msel=$plan1&domain=$domainname$domain";
$lines_array = file($url);
while (list ($line_num, $line) = each ($lines_array)) {
if ($line_num=="43"){
$result = $line;
$pos2 = strpos($result, " (");
$pos1 = strpos($result, "| Ip: ");
$ip_addr = substr($result, $pos1 + 6, $pos2 - ($pos1 + 6));

$sql = "SELECT * FROM clients WHERE username='$username' AND domainname='$domainname'";
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
$id = $myrow["id"];
$sql = "UPDATE clients SET ipaddress='$ip_addr' WHERE id=$id";
$result = mysql_query($sql);
}
}