removed sh/call.pl
[spider.git] / cmd / show / qrz.pl
index 5301c2cd6f72d35c39b562eec5eb3db15664dc4a..9dd99818d4d4bc231b7caf62c5559911e0df832b 100644 (file)
@@ -11,36 +11,31 @@ my $l;
 my $call = $self->call;
 my @out;
 
+return (1, $self->msg('e24')) unless $Internet::allow;
 return (1, "SHOW/QRZ <callsign>, e.g. SH/QRZ g1tlh") unless @list;
 
 use Net::Telnet;
 
 my $t = new Net::Telnet;
 
-push @out, $self->msg('call1', "QRZ.com");
 foreach $l (@list) {
        $t->open(Host     =>  "qrz.com",
                         Port     =>  80,
-                        Timeout  =>  5);
+                        Timeout  =>  15);
        if ($t) {
-               $t->print("GET /database?callsign=$l HTTP/1.0\n\n");
+               my $s = "GET /dxcluster.cgi?callsign=$l\&uid=$Internet::qrz_uid\&pw=$Internet::qrz_pw HTTP/1.0\n\n";
+#              print $s;
+               $t->print($s);
                Log('call', "$call: show/qrz \U$l");
-               my $state = "call";
+               my $state = "blank";
                while (my $result = $t->getline) {
-#                      print "$state: $result";
-                       if ($state eq 'call' && $result =~ /$l/i) {
-                               $state = 'getaddr';
-                               push @out, uc $l;
-                       } elsif ($state eq 'getaddr' || $state eq 'inaddr') {
-                               if ($result =~ /^\s+([\w\s.,;:-]+)(?:<br>)?$/) {
-                                       my $line = $1;
-                                       unless ($line =~ /^\s+$/) {
-                                               push @out, $line;
-                                               $state = 'inaddr' unless $state eq 'inaddr';
-                                       }
-                               } else {
-                                       $state = 'runout' if $state eq 'inaddr';
-                               }
+#                      print $result;
+                       if ($state eq 'blank' && $result =~ /^\s*Callsign\s*:/i) {
+                               $state = 'go';
+                       } elsif ($state eq 'go') {
+                               next if $result =~ /^\s*Usage\s*:/i;
+                               chomp $result;
+                               push @out, $result;
                        }
                }
                $t->close;