NAME

Heart::Domain::API - Interface to the Heart Internet Domain Reseller API

SYNOPSIS

# The below example connects to the Heart Internet Domain API
# Automatically logs in using the clid and pw vars and performs a 
# domain lookup. The extension(s) must be passed in an array.
# whois() will return false (0) on an unsuccessful lookup, or a 
# HASH if it succeeds.

use Heart::Domain::API;

my $h = Heart::Domain::API->new; # accepts default configuration with no extra arguments

$h->vars(
    clid   => 'ccf0049fd0f38c61',   # for logging in
    pw     => 'FSAFDSfdsfa',        # for logging in
    cltrid => $h->gen_trID          # generate a random transaction id for the session
);

# pasing 1 in connect() will force SSL hostname verification
if ($h->connect(1)) {
    if (my %result = $h->whois('mydomain.com', qw/.com .co.uk .net/)) {
        for (keys %result) {
            my $avail = ($result{$_}) ? 'Available' : 'Not Available';
            print "The domain, $_, is $avail for registration\n";
        }
    }
}

DESCRIPTION

This module is used as a 'SDK' to Heart Internet's API. Using Heart::Domain::API there's no need to parse complex XML structures or worry about SSL Sockets. Quickly add a new contact, perform a domain lookup or create your own templates to use other calls that have not been implemented by Heart::Domain::API. Please note this module is under heavy construction and the author is in no way affiliated with Heart Internet. Please let me know if you'd like anything added/changed :-)

test

Usage:

my $h = Heart::Domain::API->new;
unless( $h->test ) {
    print "Oh noes! Didn't load properly :/\n";
}

Purpose: Test simply makes sure the module loaded OK. Doesn't do much, really. Returns: 0 if it errors, or 1 on successful check.

new

Usage:

my $h = Heart::Domain::API->new(
    -server     => 'customer.heartinternet.co.uk',
    -port       => 700,
    -debug      => 1,
    -path       => '/usr/local/myapp/var'
);

Purpose: The constructor. You can override default configuration here also.

vars

Usage:

   my $h = Heart::Domain::API->new;

   $h->vars(
       domain  => 'example.com',
       cltrid  => $h->gen_trID
   );

Purpose: Sets variables that can be used within the templates

connect

Usage:

my $h = Heart::Domain::API->new;

$h->vars(
    clid    => 'myclid',
    pw      => 'mypass'
);

$h->connect(1);

Purpose: Connects to the Heart Internet API using the information in vars() Arguments: Pass 1 as an argument to enable hostname verification