Srsplus.com is one of leading domain name providers but they only offer C and Perl clients for their API. This class will enable you to communicate with their API from PHP.
This text assumes you have system with PHP5+ (with Curl, Gnupg, SSL enabled), GnuPG installed and Srsplus.com reseller account active.
If you are missing GnuPG on your linux box you can read nice post on how to set it up here: http://ubuntuforums.org/showthread.php?t=680292
If you need to install GnuPG support on your existing PHP5 configuration look it up here: http://php.net/manual/en/gnupg.installation.php
First of all you will need to exchange keys with Srsplus.com, contact them and their staff will help you through this process. (you can see how gnupg works on above links) Once you have generated keys you will need to place them in folder on your server where you can access them from php/apache. Fill in path to GnuPG keys in $gnupg_path variable below. Once you get api access from srsplus.com they will provide you with the cacert.pem file. Again, copy that file in folder on your server and type in path to the file in $certificate_path variable. While generating keys for GnuPG you can enter email and passphrase (it's a 'password' for your keys) if you didn't leave it blank type in exact passphrase in $passphrase variable, email should be typed in $gnupg_key_email variable.
Once you have setup GnuPG you can move on to typing in your Srsplus account details, fill them in in Srsplus.com section.
Variable $test_mode is used to change from production to development. 1 - test/development mode is on, 0 - production mode is on
Thats about it, look in example files to see how to register/renew... domains.
require_once('srs_api.class.php');
$domain_name = 'example-domain';
$domain_type = 'com';
$srs = new Srs_api();
$response = $srs->who_is($domain_name, $domain_type);
print $response;
require_once('srs_api.class.php');
$domain_name = 'example-domain';
$domain_type = 'com';
$years = 1; // number of years we want to renew min: 1 max: 10
$srs = new Srs_api();
$response = $srs->renewDomain($domain_name,
$domain_type,
$years);
print_r($response);
require_once('srs_api.class.php');
$srs = new Srs_api();
$contact = array(
'TLD' => 'com',
'FNAME' => 'John',
'LNAME' => 'Smit',
'ORGANIZATION' => 'ACME LTD',
'EMAIL' => 'john.smit@acme.com',
'ADDRESS1' => 'Big streed 1/23',
'ADDRESS2' => '',
'CITY' => 'Big City',
'PROVINCE' => '',
'COUNTRY' => 'US',
'PHONE' => '5555551212 ',
'POSTAL CODE' => '11000',
);
$tech_contactid = $srs->createContact($contact);
$contact = array(
'TLD' => 'com',
'FNAME' => 'Ben',
'LNAME' => 'Smit',
'ORGANIZATION' => 'ACME LTD',
'EMAIL' => 'ben.smit@acme.com',
'ADDRESS1' => 'Big streed 1/23',
'ADDRESS2' => '',
'CITY' => 'Big City',
'PROVINCE' => '',
'COUNTRY' => 'US',
'PHONE' => '5555551212 ',
'POSTAL CODE' => '11000',
);
$admin_contactid = $srs->createContact($contact);
$domain_name = 'example-domain';
$domain_type = 'com';
$years = 1; // number of years we want to register min: 1 max: 10
$dns_servers = Array('dns1.domain.com', 'dns2.domain.com', 'dns3.domain.com'); //minimum 2
$response = $srs->registerDomain($domain_name,
$domain_type,
$years,
$admin_contactid,
$tech_contactid,
$dns_servers);
print_r($response);
Great component!
Questions & Comments