I'm trying to make this script that will look up each callsign in my log on www.qrz.com and get what country they're from. I know that the qrz site was having problems today, but it's up now, and the script still doesn't work. I noticed that %temptext was equal to something like "HTTP 200 OK" at one point, which I don't think is a good thing. The file that this is reading is a simple text file with each callsign on its own line. Here's the code:
Code:
on 1:sockopen:qrz: {
  set %url   /detail/ $+ $read("C:\Documents and Settings\Owner\Desktop\hams.txt",%ln)
  sockwrite -n $sockname GET %url HTTP/1.1
  sockwrite -n $sockname Host: www.qrz.com $+ $crlf $+ $crlf 
}
on 1:sockread:qrz:{  
  if ($sockerr) {    
    echo -a Error.    
    halt  
  }  
  else {    
    sockread %temptext 
    if ($mid(%temptext,41,7) == Country) {
      var %head = <tr bgcolor="#FFFFFF"><td align="right">
      var %mid = </td><td><b>
      var %end = </b></td></tr>
      %text = %text $+ $chr(32) $+ $remove(%temptext,%head,%mid,%end)
      write "C:\Documents and Settings\Owner\Desktop\hams2.txt" %text
      unset %text
    }
    elseif ($left(%temptext,14) == <title>QRZ.COM) {
      var %head = <title>QRZ.COM
      var %mid = </td><td><b><a href="/callsign/N4BWR">
      var %end = </title>
      set %text $remove(%temptext,%head,%end)
    }
  }
  %ln = %ln + 1  
  sockclose qrz
  if (%ln >= $lines("C:\Documents and Settings\Owner\Desktop\hams.txt")) {
    $qrz
  }
}
alias qrz {
  sockopen qrz www.qrz.com 80
}


If you want one or two callsigns to test it out, you can try NA1SS (the space station) and W1AW (ARRL headquarters). Thanks.