Creating siteworx accounts automatically by a script

Is it possible to script the creation of a siteworx account based on xml input from an external system (a shopping cart). When someone buys a package, they enter name/email/domain information, which we then need to have automatically trigger the creation of a new siteworx account with that information.

Has anyone done this, and are there command line scripts for account creation that can do this?

Interworx has an API which you can use to create accounts.

May be worth looking at?

That sounds like it might work. Is it documented anywhere?

PM your email address to me and I’ll send you the API doc in PDF.

We use this API for a while

here is a snapshot of our PHP code


<?
require_once( 'xmlrpc-request.php' );

$hostname ='my.hostname.com';
$access_key = "paste the key from nodeworx here";

$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)
);

 $result = xmlrpc_request( $hostname, '2443', 'https', 'iworx.createaccount', $message, 0 );

 if ($result == "SUCCESS" ) {
       // email user and do the stuff 
 }
 else 
 {
      // email the error code $result to staff 
 }

For the variables name, see the PDF

Hope this help

Pascal

ps

We read all the data from a database, because the data of the session is lost when calling this pgm

We don’t show you how, but the idea is simple. Save all the data in a tmp database, then read it here in this program and update ythe statut of the account (created, to create, etc)

Pascal