NAME

Net::Whois::Gateway::Client - Interface to Net::Whois::Gateway::Server

SYNOPSIS

use strict;
use Net::Whois::Gateway::Client;

my @all_results = Net::Whois::Gateway::Client::whois( query => ['reg.ru', 'yandex.ru'] );

# or

my @domains = qw(
    yandex.ru
    rambler.ru
    reg.ru
    google.com    
);

my @all_results = Net::Whois::Gateway::Client::whois(
    query        => \@domains,
    gateway_host => '192.168.0.5',    # default 'localhost'
    gateway_port => '888',            # default 54321
    referral     => 0,                # default 1
    server       => 'whois.ripn.net', # default try to auto-determine
    omit_msg     => 0,                # default 2
    use_cnames   => 1,                # default 0
    timeout      => 60,               # default 30
    local_ips    => ['192.168.0.1'],  # default use default ip
    cache_dir    => '~/whois_temp',   # default '/tmp/whois-gateway-d'
    cache_time   => 5,                # default 1
);

foreach my $result ( @all_results ) {
    my $query = $result->{query} if $result;
    if ($result->{error}) {
        print "Can't resolve WHOIS-info for ".$result->{query}."\n";
    } else {
        print "QUERY: ".$result->{query}."\n";
        print "WHOIS: ".$result->{whois}."\n";
        print "SERVER: ".$result->{server}."\n";
    };
}                            

DESCRIPTION

Net::Whois::Gateway::Client - it's an interface to Net::Whois::Gateway::Server, which provides a very quick way to get WHOIS-info for list of domains, IPs or registrars. Internally uses POE to run parallel non-blocking queries to whois-servers. Supports recursive queries, cache, queries to HTTP-servers.

You definitely need install Net::Whois::Gateway::Server first, to use Net::Whois::Gateway::Client.

Functions

whois()

whois( query => \@query_list [, param => $value] ) Get whois-info for list of queries. One argument is required and some optional:

whois() parameters

query

query is an arrayref of domains, ips or registrars to send to whois server. Required.

gateway_host

Host to connect. Whois-gateway should be running there. Default 'localhost';

gateway_port

Port to connect. Default 54321;

server

Specify server to connect. Defaults try to be determined by the component. Optional.

referral

Optional.

0 - make just one query, do not follow if redirections can be done;

1 - follow redirections if possible, return last response from server; # default

2 - follow redirections if possible, return all responses;

Exapmle: my @all_results = Net::Whois::Gateway::Client::whois( query => [ 'google.com', 'godaddy.com' ], referral => 2, ); foreach my $result ( @all_results ) { my $query = $result->{query} if $result; if ($result->{error}) { print "Can't resolve WHOIS-info for ".$result->{query}."\n"; } else { print "Query for: ".$result->{query}."\n"; # process all subqueries my $count = scalar @{$result->{subqueries}}; print "There were $count queries:\n"; foreach my $subquery (@{$result->{subqueries}}) { print "\tTo server ".$subquery->{server}."\n"; # print "\tQuery: ".$subquery->{query}."\n"; # print "\tResponse:\n".$subquery->{whois}."\n"; } } }

omit_msg

0 - give the whole response;

1 - attempt to strip several known copyright messages and disclaimers;

2 - will try some additional stripping rules if some are known for the spcific server.

Default is 2.

use_cnames

Use whois-servers.net to get the whois server name when possible. Default is to use the hardcoded defaults.

timeout

Cancel the request if connection is not made within a specific number of seconds. Default 30 sec.

local_ips

List of local IP addresses to use for WHOIS queries. Addresses will be used used successively in the successive queries Default SRS::Comm::get_external_interfaces_ips()

cache_dir

Whois information will be cached in this directory. Default '/tmp/whois-gateway-d'.

cache_time

Number of minutes to save cache. Default 1 minute.

Postrprocessing

Call to a user-defined subroutine on each whois result depending on whois-server supported:

$Net::Whois::Gateway::Client::POSTPROCESS{whois.crsnic.net} = \&my_func;

AUTHOR

Sergey Kotenko <graykot@gmail.com>

SEE ALSO

Net::Whois::Gateway::Server http://search.cpan.org/perldoc?Net::Whois::Gateway::Server

1 POD Error

The following errors were encountered while parsing the POD:

Around line 240:

You forgot a '=back' before '=head1'