2 # Query the QRZ Database server for a callsign
4 # from an idea by Steve Franke K9AN and information from Angel EA7WA
6 # Copyright (c) 2001 Dirk Koopman G1TLH
10 my ($self, $line) = @_;
11 my @list = split /\s+/, $line; # generate a list of callsigns
13 my $call = $self->call;
16 return (1, $self->msg('e24')) unless $Internet::allow;
17 return (1, "SHOW/QRZ <callsign>, e.g. SH/QRZ g1tlh") unless @list;
18 #my $target = $Internet::http_proxy || 'www.qrz.com';
19 #my $port = $Internet::http_proxy_port || 80;
21 #$url = 'http://www.qrz.com' if $Internet::http_proxy;
22 my $target = $Internet::http_proxy || $Internet::qrz_url || 'www.qrz.com';
23 my $port = $Internet::http_proxy_port || 80;
25 $url = 'http://' . ($Internet::qrz_url | 'www.qrz.com') if $Internet::http_proxy;
30 my $t = new Net::Telnet;
34 $t->open(Host => $target,
40 push @out, $self->msg('e18', 'QRZ.com');
42 my $s = "GET $url/p/dxcluster.pl?callsign=$l\&username=$Internet::qrz_uid\&password=$Internet::qrz_pw HTTP/1.0\n\n";
43 dbg($s) if isdbg('qrz');
45 Log('call', "$call: show/qrz \U$l");
47 while (my $result = eval { $t->getline(Timeout => 30) } || $@) {
48 dbg($result) if isdbg('qrz') && $result;
50 push @out, $self->msg('e18', 'QRZ.com');
53 if ($state eq 'blank' && $result =~ /^\s*Callsign\s*:/i) {
55 } elsif ($state eq 'go') {
56 next if $result =~ /^\s*Usage\s*:/i;
62 push @out, $self->msg('e3', 'qrz.com', uc $l) unless @out;