Try not to correct other people if you aren't too experienced at it in the first place. What he has works fine.

Code:
var %r
  sockread %r
  while ($sockbr > 0) {
    tokenize 32 %r
    if stuff here..
    sockread %r
  }


Since you don't seem to understand, I'll point a few things out to you, mIRC dumps text (up to the next CRLF) into the variable. This means that there can still be "downloaded" information in the sockread buffer, so when you perform a "sockread" at the bottom of the while loop, it grabs the new information, and you parse it at the top of the loop.

The way it's listed above is the fastest way to deal with sockets, as it empties the buffer, instead of retriggering the on sockread event unnecessarily. (This is mentioned in the mIRC help file.)

My only problem with this way of parsing webpages, is that when the buffer reaches the last bit of information, it spits it out, even though there isn't a CRLF to end the line.

This left me with having to deal with things like:
<a href="
http://..........">blah</a>

On two seperate parsed strings. Which is a pain in the ass. So I generally just make mIRC work the tough way, and just let it retrigger the event over and over again. Just my two cents.


As for the original poster: What you have there will work fine. Though you may want to add this in your "on sockopen" event: if ($sockerr) { echo -sg *** Couldn't connect to the server. }