Hello
For those whom are interesting to use the Iworx Api to create Siteworx account here is how I use the iworx.createaccount API.
It is not Up to date, some of new iworx functionalities are not in (billing day, sxriptworx, …)
For me, when a user pay from my web site I register all informations in a database.
Then I have a cronjob that runs every 5mn which read the database, and create the new account by calling the API
require_once( 'xmlrpc-request.php' );
$hostname_1 = 'my.hostname1.com';
$access_key_1 = "
copy/paste you access key here
";
$hostname_2 = 'my.hostname2.com';
$access_key_2 = "
copy/paste you access key here
";
// etc...
// Read the database here
// Move data from database to local variables here
$id = $donnees['id'];
$ai_pseudo = $donnees['pseudo']; //pseudo of siteworx account
$ai_email = $donnees['email']; // email of siteworx account
$ai_passwd = $donnees['password']; //password of siteworc account
$ai_domaine = $donnees['domaine']; //domaine of siteworx account
$ai_ip = $donnees['ip']; // IP of siteworx account
$LG_OPT_STORAGE = $donnees['storage']; // 999999999 = illimited
$LG_OPT_BANDWIDTH = $donnees['bandwidth']; // 999999999 = illimited
$LG_OPT_EMAIL_ALIASES = $donnees['email_aliases']; // 999999999 = illimited
$LG_OPT_EMAIL_AUTORESPONDERS = $donnees['email_autoresponders']; // 999999999 = illimited
$LG_OPT_EMAIL_BOXES = $donnees['email_boxes']; // 999999999 = illimited
$LG_OPT_EMAIL_GROUPS = $donnees['email_groups']; // 999999999 = illimited
$LG_OPT_FTP_ACCOUNTS = $donnees['ftp_accounts']; // 999999999 = illimited
$LG_OPT_MYSQL_DBS = $donnees['mysql_dbs']; // 999999999 = illimited
$LG_OPT_MYSQL_DB_USERS = $donnees['mysql_db_users']; // 999999999 = illimited
$LG_OPT_POINTER_DOMAINS = $donnees['pointer_domains']; // 999999999 = illimited
$LG_OPT_SUBDOMAINS = $donnees['subdomains']; // 999999999 = illimited
$LG_OPT_CGI_ACCESS = $donnees['cgi_access']; // False or True
$LG_OPT_CRONTAB = $donnees['crontab']; // False or True
$LG_OPT_RESOLVE_XFERLOG_DNS = $donnees['resolve_xferlog_dns']; // False or True
$LG_OPT_SSL = $donnees['ssl']; // False or True
$LG_OPT_BURSTABLE = $donnees['burstable']; // False or True
$LG_OPT_SAVE_XFER_LOGS = $donnees['save_xfer_logs']; // False or True
// depending of the server IP I have not the same access_key and hostname
// if IP = xxx then move server data else move other server data
if (substr($ai_ip,0,9) == 'xx.xxx.xx') {
$access_key = $access_key_1;
$hostname = $hostname_1;
}
else if (substr($ai_ip,0,3) == 'xxx') {
$access_key = $access_key_2;
$hostname = $hostname_2;
}
$message = array('access_key' => $access_key,
'account_info' => array ( $ai_pseudo,
$ai_email,
$ai_passwd,
$ai_domaine,
$ai_ip),
'features_list' => array ('LG_OPT_STORAGE' => $LG_OPT_STORAGE,
'LG_OPT_BANDWIDTH' => $LG_OPT_BANDWIDTH,
'LG_OPT_EMAIL_ALIASES' => $LG_OPT_EMAIL_ALIASES,
'LG_OPT_EMAIL_AUTORESPONDERS' => $LG_OPT_EMAIL_AUTORESPONDERS,
'LG_OPT_EMAIL_BOXES' => $LG_OPT_EMAIL_BOXES,
'LG_OPT_EMAIL_GROUPS' => $LG_OPT_EMAIL_GROUPS,
'LG_OPT_FTP_ACCOUNTS' => $LG_OPT_FTP_ACCOUNTS,
'LG_OPT_MYSQL_DBS' => $LG_OPT_MYSQL_DBS,
'LG_OPT_MYSQL_DB_USERS' => $LG_OPT_MYSQL_DB_USERS,
'LG_OPT_POINTER_DOMAINS' => $LG_OPT_POINTER_DOMAINS,
'LG_OPT_SUBDOMAINS' => $LG_OPT_SUBDOMAINS,
'LG_OPT_CGI_ACCESS' => $LG_OPT_CGI_ACCESS,
'LG_OPT_CRONTAB' => $LG_OPT_CRONTAB,
'LG_OPT_RESOLVE_XFERLOG_DNS' => $LG_OPT_RESOLVE_XFERLOG_DNS,
'LG_OPT_SSL' => $LG_OPT_SSL,
'LG_OPT_BURSTABLE' => $LG_OPT_BURSTABLE,
'LG_OPT_SAVE_XFER_LOGS' => $LG_OPT_SAVE_XFER_LOGS)
);
// Send the XML request (note that you may also use port 2080 and http)
$result = xmlrpc_request( $hostname, '2443', 'https', 'iworx.createaccount', $message, 0 );
if ($result == "SUCCESS" )
{
// Your success code here (ie . send confirmation email to siteworx client)
}
Hope it may help some of you
Pascal