Sorry about that.
The entire code is this one:
<?
define("WHM_USER", "USER"); // WHM username
define("WHM_PASS", "PASS"); // WHM password
define("WHM_DOMAIN", "DOMAIN"); // IP or hostname could be enterred here
// The new account settings!
// Go to line 75 in this file, and change everything to suit your needs.
// cURL class: Thanks to Sean Huber
class CURL {
var $callback = false;
function setCallback($func_name) {
$this->callback = $func_name;
}
function doRequest($method, $url, $vars) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
if ($method == 'POST') {
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $vars);
}
$data = curl_exec($ch);
if ($data) {
if ($this->callback)
{
$callback = $this->callback;
$this->callback = false;
return call_user_func($callback, $data);
} else {
return $data;
}
} else {
return curl_error($ch);
}
curl_close($ch);
}
function get($url) {
return $this->doRequest('GET', $url, 'NULL');
}
function post($url, $vars) {
return $this->doRequest('POST', $url, $vars);
}
}
// Initialize cURL library
$curl = new CURL;
$text = $curl->get("http://" . WHM_USER . ":" . WHM_PASS . "@" . WHM_DOMAIN .":2086/");
// Create account now
// First going to this form; required, else wont work
$text = $curl->get("http://" . WHM_USER . ":" . WHM_PASS . "@" . WHM_DOMAIN .":2086/scripts2/wwwacctform");
// Fine! Set the options now.
$options = "sign=&plan=Package&domain=" . $_POST['6'] . ".domain.com&username=" . $_POST['1'] . "&password=" . $_POST['2'] . "&contactemail=" . $user_settings['emailAddress'];
// And post it!
$text = $curl->post("http://" . WHM_USER . ":" . WHM_PASS . "@" . WHM_DOMAIN .":2086/scripts/wwwacct", $options);
// Eventually you can output the text here
echo $text;
?>