API pbm

Hello,

I use your API to automaticly create siteworx account.

I use the xml-rpc library for php from INCUTIO (http://scripts.incutio.com/xmlrpc/)

Everything is working fine, but :

  • I alaways have an error returning “Something went wrong - 902 : Domain Name Already Exists”
  • I can’t use port 2443

Here is a part of my PHP script

include(‘include/IXR_Library.inc.php’);

$client = new IXR_Client(‘padawan.carat-hosting.com’, ‘/nodeworx/xmlrpc-api.php’, 2080);

if (!$client->query(‘iworx.createaccount’,
Array (‘access_key’ => ‘fjt8wn1lkjfjt8wn1lkjxx’,
‘account_info’ => Array (‘admin’,
‘admin@test.com’,
‘testpasswd’,
domain-api.com’,
‘65.110.36.146’),
‘features_list’ =>
Array (‘LG_OPT_STORAGE’ => 250,
‘LG_OPT_BANDWIDTH’ => 20,
‘LG_OPT_EMAIL_ALIASES’ => 999999999,
‘LG_OPT_EMAIL_AUTORESPONDERS’ => 999999999,
‘LG_OPT_EMAIL_BOXES’ => 999999999,
‘LG_OPT_EMAIL_GROUPS’ => 999999999,
‘LG_OPT_FTP_ACCOUNTS’ => 999999999,
‘LG_OPT_MYSQL_DBS’ => 999999999,
‘LG_OPT_MYSQL_DB_USERS’ => 999999999,
‘LG_OPT_POINTER_DOMAINS’ => 999999999,
‘LG_OPT_SUBDOMAINS’ => 999999999,
‘LG_OPT_CGI_ACCESS’ => ‘false’,
‘LG_OPT_CRONTAB’ => ‘true’,
‘LG_OPT_RESOLVE_XFERLOG_DNS’ => ‘false’,
‘LG_OPT_SSL’ => ‘false’,
‘LG_OPT_BURSTABLE’ => ‘true’,
‘LG_OPT_SAVE_XFER_LOGS’ => ‘true’))
)) {
die('Something went wrong - ‘.$client->getErrorCode().’ : '.$client->getErrorMessage());
}

It creates the siteworx account but always returns “Something went wrong - 902 : Domain Name Already Exists”

Any idea why ?

More, it could be great to improve your api and give more parameters to the iworx.createaccount to be able to use a package rather than list all parameters for creating the siteworx account.

Thanks for your help

ps : my script is in a .htaccess secure directory

Pascal

Hi Pascal,

The only reason I can think of for getting the 902 : Domain Name Already Exists is if perhaps the first time you use the script, it creates the SiteWorx account, but perhaps your script doesn’t output anything when it succeeds? So you refresh, and at that point, the domain and SiteWorx account already exist.

If you can confirm that on the very first try with a new domain name, it gives you that error, I’d appreciate it if you could provide the complete script to us so we could use it for testing, to track down the problem.

Regarding the package name parameter option you mention, agreed, this is a much desired feature and it is already in the works.

Paul

You right Paul.

The first time I run the script I have an html error : "impossible to find the server …’ but in fact it creates the siteworx account.

I’ve made a very simple PHP script to test it, my pbm is that I’m not able to test the Output value of the returns values.

here is my entire script

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>
<html>
<head>
<title>Document sans titre</title>
<meta http-equiv=“Content-Type” content=“text/html; charset=iso-8859-1”>
</head>

<body>
<?
include(‘include/IXR_Library.inc.php’);
// Specifying a client by host, path and port
$client = new IXR_Client(‘padawan.carat-hosting.com’, ‘/nodeworx/xmlrpc-api.php’, 2080);

$client->query(‘iworx.createaccount’,
Array (‘access_key’ => ‘xxx’,
‘account_info’ => Array (‘admin’,
‘admin@test.com’,
‘thiboudou’,
domain-api.com’,
‘65.110.36.146’),
‘features_list’ =>
Array (‘LG_OPT_STORAGE’ => 250,
‘LG_OPT_BANDWIDTH’ => 20,
‘LG_OPT_EMAIL_ALIASES’ => 999999999,
‘LG_OPT_EMAIL_AUTORESPONDERS’ => 999999999,
‘LG_OPT_EMAIL_BOXES’ => 999999999,
‘LG_OPT_EMAIL_GROUPS’ => 999999999,
‘LG_OPT_FTP_ACCOUNTS’ => 999999999,
‘LG_OPT_MYSQL_DBS’ => 999999999,
‘LG_OPT_MYSQL_DB_USERS’ => 999999999,
‘LG_OPT_POINTER_DOMAINS’ => 999999999,
‘LG_OPT_SUBDOMAINS’ => 999999999,
‘LG_OPT_CGI_ACCESS’ => ‘false’,
‘LG_OPT_CRONTAB’ => ‘true’,
‘LG_OPT_RESOLVE_XFERLOG_DNS’ => ‘false’,
‘LG_OPT_SSL’ => ‘false’,
‘LG_OPT_BURSTABLE’ => ‘true’,
‘LG_OPT_SAVE_XFER_LOGS’ => ‘true’))
);

if (!$client->getResponse()) { echo ‘done’; } else { die('Something went wrong - ‘.$client->getErrorCode().’ : '.$client->getErrorMessage()); }

?>

</body>
</html>

I’ve made a lot of test like :

$return=client->query(…)
echo $return;

or

echo $client->getResponse();

etc…

Maybe I should try another xml-rpc php library as the Keith Devens one that may return more simply a value (http://keithdevens.com/software/xmlrpc)

Maybe you could tell me which one you use a provide a sample php script to create sitexworx account (if you have one)

Thanks for your help

Pascal

I haven’t used this exact xmlrpc lib before, but try something like this.


$return_val = $client->query('iworx.createaccount', 
Array ('access_key' => 'xxx',
'account_info' => Array ('admin',
'admin@test.com',
'thiboudou',
'domain-api.com',
'65.110.36.146'),
'features_list' =>
Array ('LG_OPT_STORAGE' => 250,
'LG_OPT_BANDWIDTH' => 20,
'LG_OPT_EMAIL_ALIASES' => 999999999,
'LG_OPT_EMAIL_AUTORESPONDERS' => 999999999,
'LG_OPT_EMAIL_BOXES' => 999999999,
'LG_OPT_EMAIL_GROUPS' => 999999999,
'LG_OPT_FTP_ACCOUNTS' => 999999999,
'LG_OPT_MYSQL_DBS' => 999999999,
'LG_OPT_MYSQL_DB_USERS' => 999999999,
'LG_OPT_POINTER_DOMAINS' => 999999999,
'LG_OPT_SUBDOMAINS' => 999999999,
'LG_OPT_CGI_ACCESS' => 'false',
'LG_OPT_CRONTAB' => 'true',
'LG_OPT_RESOLVE_XFERLOG_DNS' => 'false',
'LG_OPT_SSL' => 'false',
'LG_OPT_BURSTABLE' => 'true',
'LG_OPT_SAVE_XFER_LOGS' => 'true'))
);

if( !$return_val ) {
  die('Something went wrong - '.$client->getErrorCode().' : '.$client->getErrorMessage());
}

print( "<pre>" );
print_r( $client->getResponse() );
print( "</pre>" );


I THINK that will at least show you the format of the response when there is success, which should help you figure out exactly how to get at the response data you want - what getResponse() returns might just be it, but like I said I haven’t used this lib so I’m not sure.

Paul

Thanks Paul but I’ve already test it like this.

The first time, the script create the siteworx account and returns a standard http error page ‘Impossible to find the server’

The second time, it is OK, the die show all the error code et message.

Do you use another php xmlprc lib ? could you tell me which one I may use ?

Thanks

Pascal

Ok nobody’s has already implement this API in his own php scripts ?

for yet the best result is :

With the http://keithdevens.com/software/xmlrpc xmlrpc php lib
and this script

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>
<html>
<head>
<title>Document sans titre</title>
<meta http-equiv=“Content-Type” content=“text/html; charset=iso-8859-1”>
</head>

<body>
<?
include(‘include/source.php’);
include(‘include/fonctions.php’);

$array = Array (‘access_key’ => ‘fjt8wn1lkjxxxxxxxx’,
‘account_info’ => Array (‘admin’,
‘admin@test.com’,
‘passwd1’,
testapi2.com’,
‘65.110.36.146’),
‘features_list’ =>
Array (‘LG_OPT_STORAGE’ => 250,
‘LG_OPT_BANDWIDTH’ => 20,
‘LG_OPT_EMAIL_ALIASES’ => 999999999,
‘LG_OPT_EMAIL_AUTORESPONDERS’ => 999999999,
‘LG_OPT_EMAIL_BOXES’ => 999999999,
‘LG_OPT_EMAIL_GROUPS’ => 999999999,
‘LG_OPT_FTP_ACCOUNTS’ => 999999999,
‘LG_OPT_MYSQL_DBS’ => 999999999,
‘LG_OPT_MYSQL_DB_USERS’ => 999999999,
‘LG_OPT_POINTER_DOMAINS’ => 999999999,
‘LG_OPT_SUBDOMAINS’ => 999999999,
‘LG_OPT_CGI_ACCESS’ => ‘false’,
‘LG_OPT_CRONTAB’ => ‘true’,
‘LG_OPT_RESOLVE_XFERLOG_DNS’ => ‘false’,
‘LG_OPT_SSL’ => ‘false’,
‘LG_OPT_BURSTABLE’ => ‘true’,
‘LG_OPT_SAVE_XFER_LOGS’ => ‘true’));

list ($success, $response) = XMLRPC_request(‘padawan.carat-hosting.com:2080’, ‘/nodeworx/xmlrpc-api.php’, ‘iworx.createaccount’, array(XMLRPC_prepare($array)));

if ($response[‘faultCode’] > 900 & $response[‘faultString’] < 914)
{
echo ‘line failed :’. $response[‘faultCode’].’ - ‘.$response[‘faultString’].’<br>‘;
}
else
{
echo ‘line success :’. $response[‘faultCode’].’ - ‘.$response[‘faultString’].’<br>';
}

?>
</body>
</html>

The first time I call the API : the siteworx account is created but the echo

echo ‘line success :’. $response[‘faultCode’].’ - ‘.$response[‘faultString’].’<br>';

isn’t show, and I have an html standard error (impossible to find the server …).

At least this line

echo ‘line success :’. $response[‘faultCode’].’ - ‘.$response[‘faultString’].’<br>';
should display this
line success : -

The second time I call the API : everything works well. I have the error returned well.

line failed :902 - Domain Name Already Exists

Nobody has already implement this API in his php script ?

An example whith your xmlrpc php lib will be very welcome :slight_smile:

Thanks
pascal

Up until ModerBill 4.2 was released, I was creating accounts manually (I’m low-volume, and mostly just for clients of my development business). Now that ModernBill 4.2 is out, it has a module for interfacing with InterWorx, so I’ve never had to write a script for it. I know DRAMS also has a module for InterWorx, but outside those two, aside from custom ones written (like yours), I doubt anyone’s written one that has been released.

Thank you, it is a pity because my script works fine the only problem is that the first time that it is carried out it does not return a value to however test if it is OK, it creates the account siteworx well automatically. The second time that it is carried out it returns well a value which says that the siteworx account already exists.

Impossible to see the sources of MB or DRAM?

erfff I am there almost… I am sure that it must be a small mistake

Thank you nevertheless, I would be the first then.

Pascal

Ok, so the result is this one :

The script works fine, but when it is a success any html confirmation page can’t be show.

If there is an error the API returns an array and the html page can be show with the error.

So the pbm is only when the API is a success.

The strange thing is that when we run the script directly on the box, there is no pbm, so the pbm come from the navigator. (We’ve tested both IE and Mozilla)

I think the pbm is that when it is a success the API may returns XML data that can’t be read by the navigator, and when it is an error the api only returns an array that can be read and show on an html page.

Any idea are welcome

Pascal

xml-rpc lib

Hey, Pascal,

I share some of the ModernBill InterWorx module code, if you like. I can also send you a copy of the xml-rpc library that we used for that module. Let me know where to send that to.

Hey Bojan,

Thanks but the pbm is not from my script or the xmlrpc php lib.

Paul found the pbm. In fact when the API create the siteworx account, APACHE is restarted, so my script stop running.

I have to run it from interworx httpd server.

Thanks for everything.

I’ll let know to everybody the final conclusion of this task. If everything is working fine, I’ll give the code that works.

Thanks to all of you

Pascal