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 || 'u2.qrz.com';
19 my $port = $Internet::http_proxy_port || 80;
21 $url = 'http://u2.qrz.com' if $Internet::http_proxy;
25 my $t = new Net::Telnet;
29 $t->open(Host => $target,
35 push @out, $self->msg('e18', 'QRZ.com');
37 my $s = "GET $url/p/dxcluster.pl?callsign=$l\&username=$Internet::qrz_uid\&password=$Internet::qrz_pw HTTP/1.0\n\n";
38 dbg($s) if isdbg('qrz');
40 Log('call', "$call: show/qrz \U$l");
42 while (my $result = eval { $t->getline(Timeout => 30) } || $@) {
43 dbg($result) if isdbg('qrz') && $result;
45 push @out, $self->msg('e18', 'QRZ.com');
48 if ($state eq 'blank' && $result =~ /^\s*Callsign\s*:/i) {
50 } elsif ($state eq 'go') {
51 next if $result =~ /^\s*Usage\s*:/i;
57 push @out, $self->msg('e3', 'qrz.com', uc $l) unless @out;