Hello,
Ive been frustrated with the fact that sockread sometimes reads wrong data.
Both when parsing to var or binvar.
I use it for parsing pages from imdb.
script:
on *:SOCKOPEN:imdb.box:{
sockwrite -nt imdb.box GET /title/tt0799949/business HTTP/1.1
sockwrite -nt $sockname Accept-Language: en-us
sockwrite -nt $sockname User-Agent: Mozilla/??
sockwrite -nt $sockname Host: $iif($ip,$ip,127.0.0.1)
sockwrite -nt $sockname Connection: Keep-Alive
sockwrite -t $sockname $str($crlf,2)
}
on *:SOCKREAD:imdb.box:{
; sockread %imdb.box.incoming
; echo 1 %imdb.box.incoming
sockread -nf &imdb.box.incoming
echo 1 info: $bvar(&imdb.box.incoming,1,$bvar(&imdb.box.incoming,0)).text
result: <snip>
info: <h5>Opening Weekend</h5>
info: $18,612,544 (USA)
info: 6a
info: (<a href="/BusinessThisDay?day=28&month=January">28 January</a> <a href="/Sections/Years/2007/">2007</a>)
info: f5d
info: (2,801 Screens)<br/>£1,368,657 (UK) (<a href="/BusinessThisDay?day=11&month=February">11 February</a> <a href="/Sections/Years/2007/">2007</a>) (326 Screens)<br/>
info: <br/>
Result should be:
<h5>Opening Weekend</h5>
$18,612,544 (USA) (<a href="/BusinessThisDay?day=28&month=January">28 January</a> <a href="/Sections/Years/2007/">2007</a>) (2,801 Screens)<br/>£1,368,657 (UK) (<a href="/BusinessThisDay?day=11&month=February">11 February</a> <a href="/Sections/Years/2007/">2007</a>) (326 Screens)<br/>
<br/>
As seen when viewing page source.
Where does:
info: 6a
info: f5d
come from??? Source page has no weird chars..
This error is consistant btw, its always the same when i try.
Sometimes i also get random bad results, causing bad output from my script..(eg run command: result is bad, run immediately again: result is good.. seems mirc is reading ghost data cuz i doubt imdb changes the page cuz i checked using browsers)
Thanks 4 any help
/edit: oh yea mirc 6.21, before i upgraded (6.14 i think) had same problem
Last edited by bwuser; 01/04/07 07:43 PM.