All pastes #398321 Raw Edit

Untitled

public text v1 · immutable
·published 2007-03-17 03:20 UTC
rendered paste body
alias weather {
  sockopen weather www.netscape.com 80
}

on *:SOCKREAD:weather:{
  if ($sockerr) {
    echo -a Error.
    halt
  }
  else {
    var %t
    sockread %t
    write _weather $+ %weather.zip $+ .txt $nohtml(%t)
  }
}
alias nohtml {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;)
  return %x
}
on *:SOCKOPEN:weather:{ 
  sockwrite -n weather GET /local/?tag= $+ %weather.zip HTTP/1.1 
  sockwrite -n weather Host: www.netscape.com $+ $str($crlf,2)
}
on *:TEXT:!weather*:#: {
  set %weather.zip $2
  weather $2
}