Just an addition to Riamus2's code I came up with this.

Code:
alias country {
  %dns = $$1
  %country = $gettok(%dns,-1,46)
  %host = $deltok(%dns,-1,46)
  sockopen country ftp.ics.uci.edu 80
}

alias -l html { 
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, ) 
  return %x 
} 

on *:sockopen:country: { 
  sockwrite -n $sockname GET /pub/websoft/wwwstat/country-codes.txt HTTP/1.1 
  sockwrite -n $sockname Host: ftp.ics.uci.edu $+ $crlf $+ $crlf
}

on *:sockread:country: {
  if ($sockerr) {
    halt
  }
  else {
    var %sock.country
    sockread %sock.country
    if (%country isin %sock.country) {
      if ($gettok($html(%sock.country),1,32) == %country) {
        ; $gettok($html(%sock.country),1,32) returns country in 2 letters.
        ; $gettok($html(%sock.country),2-,32) returns the full country name.
         echo -a $gettok($html(%sock.country),1,32) = $gettok($html(%sock.country),2-,32)
      }
    }
  }
}


/country BR - Echoes BR = Brazil
/county www.google.co.uk - Echoes UK = United Kingdom

-Andy