<?php
// start the session and pass the Session parameter
session_start();
header("Cache-control: private"); //IE 6 Fix
######### Set up basic variables #########
$serverIPaddress="192.168.1.1:2087";
$whmusername="root";
$whmpassword="123456";
$server="https://$whmusername:[email protected]$serverIPaddress";
//set the username of the account you are working with
$user = "bobby12";
$agent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)";
######### Here are few example of many of the items that you could do with curl. It will not execute until the very bottom #########
//change user's password
$url="$server/scripts/passwd?password=$passwd&domain=$user&user=$user";
//enable shell access
$url="$server/scripts2/domanageshells?user=$user&shell=Enable+Jailed+Shell&user=$user";
//bandlimit increase
$url="$server/scripts2/dolimitbw?user=$user&bwlimit=$bndwidth";
//suspend an account
$url="$server/scripts2/suspendacct?domain=$user&user=$user&suspend-domain=Suspend&reason=";
//UN-suspend an account
$url="$server/scripts2/suspendacct?domain=$user&user=$user&unsuspend-domain=UnSuspend&reason=";
//add front page extensions
$url="$server/scripts/installfp?domain=$user&user=$user&submit-domain=Install";
//remove front page extensions
$url="$server/scripts/uninstallfp?domain=$user&user=$user&submit-domain=UnInstall";
//modify the quota on the account
$url="$server/scripts/editquota?user=$user"a=$quota";
//add a domain pointer
$url="$server/scripts/park?txtdomain=&domain=$domain&ndomain=$NewDomain";
//modify the account
$url="$server/scripts/saveedituser?user=$user&BWLIMIT";
$url.="=$BWLIMIT&FEATURELIST=$FEATURELIST&IP=$IP&OWNER";
$url.="=$OWNER&PLAN=$PLAN&STARTDATE=$STARTDATE&DNS=$domain";
$url.="&RS=$RS&LANG=english&newuser=$user&seeshell=$shell&MAXPOP";
$url.="=$MAXPOP&MAXFTP=$MAXFTP&MAXLST=$MAXLST&MAXSUB=$MAXSUB&MAXSQL";
$url.="=$MAXSQL&MAXPARK=$MAXPARK&MAXADDON=$MAXADDON";
//generate a csr
//need to replace spaces in all of the variables with the '+' sign
$host = str_replace(" ","+",$host);
$country = str_replace(" ","+",$country);
$state = str_replace(" ","+",$state);
$city = str_replace(" ","+",$city);
$cod = str_replace(" ","+",$cod);
$co = str_replace(" ","+",$co);
$email = str_replace(" ","+",$email);
$pass = str_replace(" ","+",$pass);
$url="$server/scripts/gencrt?xemail=$xemail&host=$host&country";
$url.="=$country&state=$state&city=$city&co=$co&cod=$cod&email=$email&pass=$pass";
######### execute curl #########
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookie.txt');
curl_setopt($ch, CURLOPT_MAXREDIRS, 4);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
$buffer = curl_exec($ch);
curl_close($ch);
?>