/usr/share/doc/libwww-cnic-perl/examples/search.cgi is in libwww-cnic-perl 0.38-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | #!/usr/bin/perl
# an example of how to use WWW::CNic in a web environment.
# a comparable script using the whois server works substantially slower.
# $Id: search.cgi,v 1.2 2011/05/13 13:31:49 gavin Exp $
use WWW::CNic;
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
use Date::Manip;
use strict;
my $doc_title = 'Domain Search';
my @suffixes = qw(uk.com uk.net us.com eu.com de.com);
print header() .
start_html($doc_title),
h1($doc_title) .
start_form() .
p('Enter domain: '.textfield('domain')) .
scrolling_list( -name => 'suffixes',
-values => \@suffixes,
-size => 5,
-multiple => 'true') .
br() .
submit() .
end_form();
my @suffixlist = param('suffixes');
if (param('domain') ne '' && scalar(@suffixlist) > 0) {
print hr() .
h2('Results');
my $query = WWW::CNic->new( command => 'search',
use_ssl => 0,
domain => param('domain'),
);
$query->set(suffixlist => \@suffixlist);
my $response = $query->execute();
if ($response->is_error) {
print h2('Error') .
p($response->error());
} else {
my @results;
foreach my $suffix(@suffixlist) {
if ($response->is_registered($suffix)) {
push(@results, li(sprintf( "Domain %s.%s is registered to %s and expires on %s.",
param('domain'),
$suffix,
$response->registrant($suffix),
UnixDate('epoch '.$response->expiry($suffix), "%b %e %Y")
))
);
} else {
push(@results, li(sprintf("Domain %s.%s is available for registration.", param('domain'), $suffix)));
}
}
print ul(\@results);
}
}
print end_html();
exit;
|