In your sockopen section put something like
The halt commands are unnecessary. The changes I made will store the non-html format of the line read into the variable(s). Also please note that the wildcard string that you're doing the comparison on might be matched on the very first match, so that would close the socket, even if there are more lines in the document.
Then change your sockread to
on *:sockread:blah:{
if ($sockerr) {
echo -a Error.
}
else {
var %data
sockread %data
set $+(%,row,%row) $nohtml(%data)
inc %row
if (<tr><td>*</td><td>*</td><td>*</td><td>*</td><td>*</td></tr> iswm %data) {
echo -a $nohtml(%data)
sockclose $sockname
}
}
}