Create a WHM/cPanel Account

This snippet will allow you to create a cPanel account using PHP.

<?php

// your WHM username
$whm_user = 'root';

// your WHM password
$whm_pass = 'password';

// your WHM hostname
$whm_host = '123.123.123.123';

// new account domain or subdomain name
$user_domain = 'newdomain.com';

// new account username (8 characters or less)
$user_name = 'newuser';

// new account password
$user_pass = 'password'

// new account contact email
$user_email = 'user@domain.com';

// new account plan (must be an existing WHM plan)
$user_plan = 'basic';

// create the account
$site = "http://{$whm_user}:{$whm_pass}@{$whm_host}:2086/scripts/wwwacct";
$params = "?plan={$user_plan}";
$params .= "&domain={$user_domain}";
$params .= "&username={$user_name}";
$params .= "&password={$user_pass}";
$params .= "&contactemail={$user_email}";
$result = file_get_contents($site.$params);
echo $result;

?>

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <b> <i> <strong> <cite> <em> <code> <pre> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <css>, <diff>, <drupal5>, <html>, <javascript>, <php>. The supported tag styles are: <foo>, [foo]. PHP source code can also be enclosed in <?php ... ?> or <% ... %>.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.