A few days ago, when I got bored, I wrote this small bunch of code for automated WHM account creation.
It does works, but note that this is just a rough bunch of code; you'll have to change a lot of settings in order to get the script suit your needs.
There is also no checkup written into it to check if the account really is created
**NOTE 1: PHP Safe Mode must be turned off, in order to get this script working, else a few cURL options will issue an error.
**NOTE 2:cURL must be installed at your PHP server.
**NOTE 3:Create an empty cookie.txt file, upload it to your server, and make sure it is 777-CHMOD'ed
If you like the script, rep is appreciated
whm-create.php
PHP Code:
<?php
/* HOW TO INSTALL
1 - Save this code as a PHP file (or any file, as long as the server recognizes it as PHP)
2 - Change the configuration part in this file, save it, and upload to your server
3 - Create an empty .txt file in notepad, call it cookie.txt, upload it to your server.
4 - Is your server a unix-like server? CHMOD that file to 777.
This is not need for windows servers.
*/
// Configure
define("WHM_USER", "your-username"); // WHM username
define("WHM_PASS", "your-password"); // WHM password
define("WHM_DOMAIN", "127.0.0.1"); // 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;
}
// 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=hansvdp_tp&domain=tgz33.com&username=tg33&password=test"a=6&ip=0&cgi=1&frontpage=1&maxftp=unlimited&maxpop=unlimited&maxlst=unlimited&maxsql=unlimited&maxsub=unlimited&maxpark=5&maxaddon=3&bwlimit=50&cpmod=x&msel=n,y,unlimited,y,unlimited,unlimited,unlimited ,unlimited,unlimited,unlimited,unlimited,y,0,0&contactemail=hansvdp@gmail.com";
// 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;
?>
If you need any support with it, just reply to this topic, i'm watching it
Nice little script, i have never used much of curl as i have never had a use for it but my upcoming project will so i will be sure to check it out Sounds like a powerful little package from what i hear.
+Rep added, i will try it when i get back onto WHM/Reseller.