Login

Create account and register the domain

This example shows how a reseller via Perl connects to our XML-RPC server, creates a hosting account and registers a domain name.

Note that the following code example contains no error handling for the sake of readability.

Example

Below you find the code for the example above.

 
#!/usr/bin/perl

use RPC::XML;
use RPC::XML::Client;
use Data::Dumper;
use Encode;

my $global_check_domain_server_url = 
   'https://api.loopia.se/RPCSERV';

my $global_username = "YOUR_USERNAME";
my $global_password = "YOUR_PASSWORD";

my $client = 
   RPC::XML::Client->new($global_check_domain_server_url);
$RPC::XML::ENCODING = "UTF-8";

my $contact = {	"firstname" => "Anders",
   "lastname" => "Andersson",
   "company" => "Loopia AB",
   "street" => "Kopparbergsvägen 8",
   "street2" => "",
   "zip" => "722 13",
   "city" => "Västerås",
   "country_iso2" => "se",
   "orgno" => "556633-9304",
   "phone" => "021-128222",
   "cell" => "",
   "fax" => "",
   "email" => "info\@loopia.se" };

foreach my $key (keys %$contact) {
	Encode::from_to($contact->{$key}, 'UTF-8', 'UTF-8');
}

my $domain = "anderstestarapi" . `date +%s | tr -d "\n"` . ".se";

my $response = 
   $client->simple_request('createNewAccount', $global_username,
   $global_password, $domain, $contact, RPC::XML::boolean->new(0),
   RPC::XML::boolean->new(0), RPC::XML::boolean->new(1),
   'HOSTING_UNIX', 'HOSTING_BUSINESS', RPC::XML::boolean->new(1));

print "Account created: " . Dumper($response) . "\n\n";

 

Hey, do you need assistance?

Weekdays: 8AM - 7PM Weekends: 11 AM - 3 PM