i made a script that uses a socket to get an info from a whois server. All is ok, but when i pass any of .online tld's domain response from whois.nic.online is: DOMAIN NOT FOUND!. But when i use command "whois -h whois.nic.online example.online" in the terminal(Linux) i get all info that i needed. Please tell me what is the problem with the WHOIS.NIC.ONLINE?
use strict;
use warnings;
use IO::Socket;
if (scalar @ARGV == 0 or $ARGV[0] =~ /^[\d]{1, 20}/) {
print "There is no parameter\n";
exit();
}
my $domain_name = $ARGV[0];
my $query_resp_server_socket = new IO::Socket::INET(
PeerAddr => 'whois.iana.org',
PeerPort => 43,
Proto => 'tcp');
print {$query_resp_server_socket} "$domain_name\n";
print $query_resp_server_socket "\r\n";
my @answer_from_iana = <$query_resp_server_socket>;
close($query_resp_server_socket);
my $responsive_whois_server;
foreach (@answer_from_iana) {
if(/whois\.[a-zA-Z0-9-]{2, 20}\.[a-zA-Z0-9-]{2, 20}$/) {
if ($& eq "whois.nic.online") {
$responsive_whois_server = "whois.nic.online";
}
else {
$responsive_whois_server = $&;
}
}
}
my $query_data_socket = new IO::Socket::INET(
PeerAddr => $responsive_whois_server,
PeerPort => 43,
Proto => 'tcp');
print {$query_data_socket} "$domain_name\n";
print $query_data_socket "\r\n";
my @answer_from_resp_server = <$query_data_socket>;
close($query_data_socket);
if ( scalar @ARGV == 1 ) {
print @answer_from_resp_server;
}
elsif( scalar @ARGV == 2 and $ARGV[1] eq "-exp" ) {
foreach (@answer_from_resp_server) {
if (/paid-till|Registry Expiry Date/) {
print $_;
}
else {
print "Info was not found."
}
}
}
elsif( scalar @ARGV == 2 and $ARGV[1] eq "-stat" ) {
foreach (@answer_from_resp_server) {
if (/state|Domain Status/) {
print $_;
}
else {
print "Info was not found."
}
}
}
elsif ( scalar @ARGV == 2 and $ARGV[1] eq "-adm" ) {
foreach (@answer_from_resp_server) {
if (/person|Registrant Organization/) {
print $_;
}
else {
print "Info was not found."
}
}
}