napa182 commented on a Page, Harry Potter Pickup Lines  -  Jun 21, 2010

using a socket would be better
here is a fast mock up...

on $*:text:/^@HPlines$/iS:#: {
  if (!$hget(HP,C)) {
    if ($sock(HPlines)) sockclose HPlines
    sockopen HPlines www.pickuplinesgalore.com 80
    sockmark HPlines $r(1,28) msg # Harry Potter pick up line
  }
}
on *:sockopen:HPlines: {
  sockwrite -nt $sockname GET /harrypotter.html HTTP/1.1
  sockwrite -nt $sockname Host: $+(www.pickuplinesgalore.com,$str($crlf,2))
}
on *:sockread:HPlines: {
  var %HPlines | sockread %HPlines
  if ($regex(%HPlines,/<td><span class=.+>(.+)<\/span><\/td>/)) {
    hinc -mu5 HP C 1
    if ($hget(HP,C) = $gettok($sock(HPlines).mark,1,32)) {
      $gettok($sock(HPlines).mark,2-,32) $+($chr(35),$v1,:) $&
        $replace($regml(1),&quot;,")
      sockclose HPlines
    }
  }
}
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.