Subversion Repositories vgwhois

Rev

Rev 5 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5 Rev 11
Line 1... Line 1...
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
 
2
 
3
#
3
#
4
#  VWhois (ViaThinkSoft WHOIS, a fork of generic Whois / gwhois)
4
#  VGWhoIs (ViaThinkSoft Global WhoIs, a fork of generic Whois / gwhois)
5
#  Subprogram: gh TLD whois
5
#  Subprogram: gh TLD whois
6
#
6
#
7
#  (c) 2015 by Daniel Marschall, ViaThinkSoft <info@daniel-marschall.de>
7
#  (c) 2015 by Daniel Marschall, ViaThinkSoft <info@daniel-marschall.de>
8
#
8
#
9
#  License: https://www.gnu.org/licenses/gpl-2.0.html (GPL version 2)
9
#  License: https://www.gnu.org/licenses/gpl-2.0.html (GPL version 2)
Line 13... Line 13...
13
use strict;
13
use strict;
14
use utf8;
14
use utf8;
15
 
15
 
16
use FindBin;
16
use FindBin;
17
use lib "$FindBin::RealBin/../../lib/";
17
use lib "$FindBin::RealBin/../../lib/";
18
use GWhoIs::Core;
18
use VGWhoIs::Core;
19
 
19
 
20
if (defined $ARGV[0]) {
20
if (defined $ARGV[0]) {
21
	$_ = join(' ', @ARGV);
21
	$_ = join(' ', @ARGV);
22
} else {
22
} else {
23
	# If no parameter is given, await an input from STDIN
23
	# If no parameter is given, await an input from STDIN
Line 35... Line 35...
35
	$sld = '';
35
	$sld = '';
36
}
36
}
37
 
37
 
38
my $host = 'http://www.nic.gh'; # TODO: https?
38
my $host = 'http://www.nic.gh'; # TODO: https?
39
 
39
 
40
my ($protocol, $hostname) = GWhoIs::Utils::splitProtocolHost($host);
40
my ($protocol, $hostname) = VGWhoIs::Utils::splitProtocolHost($host);
41
 
41
 
42
#print "Querying $hostname with $protocol.\n";
42
#print "Querying $hostname with $protocol.\n";
43
 
43
 
44
# TODO: !defined $dom
44
# TODO: !defined $dom
45
my ($text, $exitcode) = GWhoIs::Core::doquery('','cgipost',"$host/customer/result_c.php","r_cdm=$dom&r_dom_slvl=$sld&Submit=Search");
45
my ($text, $exitcode) = VGWhoIs::Core::doquery('','cgipost',"$host/customer/result_c.php","r_cdm=$dom&r_dom_slvl=$sld&Submit=Search");
46
if ($exitcode) {
46
if ($exitcode) {
47
	# print STDERR "Query to web server failed.\n";
47
	# print STDERR "Query to web server failed.\n";
48
	print $text;
48
	print $text;
49
	exit $exitcode;
49
	exit $exitcode;
50
}
50
}
51
 
51
 
52
if ( $text =~ m|(customer/displayresult_c.php\?id=\d+)|s ) {
52
if ( $text =~ m|(customer/displayresult_c.php\?id=\d+)|s ) {
53
	print "Match found. Now querying for the domain data.\n\n";
53
	print "Match found. Now querying for the domain data.\n\n";
54
	($text, $exitcode) = GWhoIs::Core::doquery($query,'cgi',"$host/$1");
54
	($text, $exitcode) = VGWhoIs::Core::doquery($query,'cgi',"$host/$1");
55
	print $text;
55
	print $text;
56
} else {
56
} else {
57
	print "No match found. This probably means that this domain does not exist.\n";
57
	print "No match found. This probably means that this domain does not exist.\n";
58
}
58
}
59
 
59