Net::Whois::Gateway::Client - Interface to Net::Whois::Gateway::Server
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 => 10, # 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"; }; }
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.
whois( query => \@query_list [, param => $value] ) Get whois-info for list of queries. One argument is required and some optional:
query is an arrayref of domains, ips or registrars to send to whois server. Required.
Host to connect. Whois-gateway should be running there. Default 'localhost';
Port to connect. Default 54321;
Specify server to connect. Defaults try to be determined by the component. Optional.
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"; } } }
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 whois-servers.net to get the whois server name when possible. Default is to use the hardcoded defaults.
Cancel the request if connection is not made within a specific number of seconds. Default 10 sec.
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()
Whois information will be cached in this directory. Default '/tmp/whois-gateway-d'.
Number of minutes to save cache. Default 1 minute.
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;
Pavel Boldin <davinchi@cpan.org> Sergey Kotenko <graykot@gmail.com>
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:
You forgot a '=back' before '=head1'
To install Net::Whois::Gateway::Client, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Whois::Gateway::Client
CPAN shell
perl -MCPAN -e shell install Net::Whois::Gateway::Client
For more information on module installation, please visit the detailed CPAN module installation guide.