Creating a cPanel account is not a tough task. With the help of the following script, you can create the cpnale account by just passing the WHM Login Info and the Domain related info of the account.
WHM cPanle Account Creation
- Code: Select all
<?
$sWhmUsername = ""; // WHM Account Username
$sWhmPassword = ""; // WHM Account Password
$sWhmHost = ""; // WHM Server Address or IP
$sDomain = ""; // Domain Name (without www)
$sUsername = ""; // cPanel Account Username
$sPassword = ""; // cPanel Account Password
$sPackage = ""; // WHM Hosting Package Name
$sEmail = ""; // cPanel Contact Email Address
$sRequestUrl = "http://{$sWhmUsername}:{$sWhmPassword}@{$sWhmHost}:2086/scripts/wwwacct?plan={$sPackage}&domain={$sDomain}&username={$sUsername}&password={$sPassword}&contactemail={$sEmail}";
$sResult = @file_get_contents($sRequestUrl);
if (@strpos($sResult, "Account Creation Status: ok") !== FALSE)
print "Hosting Account Created Successfully";
else
print ("ERROR: ".$sResult);
?>
With the help of above PHP Code, you can easily create a cpanel account. You can use this script as a standalone or can integrate this into any other script.
If you want to delete an existing cpanel account, you can also do that with the help of the following PHP Code.
WHM cPanel Account Deletion
- Code: Select all
$sWhmUsername = ""; // WHM Account Username
$sWhmPassword = ""; // WHM Account Password
$sWhmHost = ""; // WHM Server Address or IP
$sUsername = ""; // cPanel Account Username
$sRequestUrl = "http://{$sWhmUsername}:{$sWhmPassword}@{$sWhmHost}:2086/scripts/killacct?domain={$sUsername}&user={$sUsername}";
$sResult = @file_get_contents($sRequestUrl);
if (@strpos($sResult, "Account Removal Status: ok") !== FALSE)
print "Hosting Account Deleted Successfully";
else
print ("ERROR: ".$sResult);
Both of these PHP Scripts are well tested and found 100% working.