sockread issues - 30/06/03 12:24 AM
I have a script which downloads a webpage from a webserver and goes through the code to pick out certain variables. I want it to pick out the line after :
<font color=yellow>
It works fine almost always but sometimes it doesn't. Since the /sockread reads only so much into the buffer at once, the buffer runs out right after the font tag is read. Is there a way to prevent this from happening?
Here's a portion of what's echoed back:
<font color=yellow>
It works fine almost always but sometimes it doesn't. Since the /sockread reads only so much into the buffer at once, the buffer runs out right after the font tag is read. Is there a way to prevent this from happening?
Code:
on 1:SOCKREAD:hiscores: { echo 4 -a RELOAD if ($sockerr > 0) { return } :nextread sockread %line if ($sockbr == 0) { return } echo -a >> %line if ((%search != 0) && (%line = <font color=yellow>)) { ; echo -a !> %search sockread %line % [ $+ [ %search ] ] = $left(%line,$calc($len(%line)-4)) %search = 0 } if ($regex(%line,(?:<table><tr>|</td>)<td><b>(.*)</b><br>) != 0) { %search = $regml(1) ; echo -a >> %search } if ((%Name != $null) && (%XP != $null) && (%Rank != $null) && (%Level != $null)) { displayresults return } else { goto nextread } }
Here's a portion of what's echoed back:
Code:
>> 46400250<br> >> 32837000<br> >> 58606250<br> >> 34997000<br> >> <font color=yellow> [color:red] RELOAD[/color] >> 34630500<br> >> </font> >> 33782500<br> >> 27138500<br>