mIRC Homepage
Posted By: Intestinal get info from webpage - 04/11/04 01:28 PM
I need som help processing a web page.
this is what i got sofar.
Code:
 
on *:sockopen:utopia:{ 
  sockwrite -n $sockname GET /kingdoms/nw-31.htm?rc=742873 HTTP/1.1 
  sockwrite -n $sockname Host: u1.swirve.com $+ $crlf $+ $crlf 
} 
on *:sockread:utopia:{ 
  if ($sockerr) { echo -a Error: $sock($sockname).wsmsg | halt } 
  else { sockread %temptext | echo -a Line: %temptext } 
} 


I want to remove all the html tags from the %temptext var and find some specific text and put that into hash tables..

<TR><TH>1</TH><TD>We Will Double Tap (25:31)</TD><TD ALIGN=RIGHT>7,842,558 gc</TD></TR>
<TR><TH>2</TH><TD>Monkeying To The Top (2:31)</TD><TD ALIGN=RIGHT>7,304,907 gc</TD></TR>
<TR><TH>3</TH><TD>F I R E S T O R M 1 (17:31)</TD><TD ALIGN=RIGHT>6,210,810 gc</TD></TR>

I need to extract the 1 and the We Will Double Tap (25:31) and 7,842,558 gc from the html well. i need to extract all the similar stuff from each row. any help would be appreciated.
Posted By: Coolkill Re: get info from webpage - 04/11/04 01:38 PM
You can probably use simple regular expressions to grab the data, however if they are in the same place all the time, why not just use $gettok.

i.e.
$gettok($gettok(%a,2,60),2,62) = 1,2,3,..ect

$gettok($gettok(%a,4,60),2,62) = Name.

$gettok($gettok(%a,6,60),2,62) = xxxx, gc.

It will however return the wrong values if for any reason > or < are in the text.

see, /help $gettok for more info.

Eamonn.
Posted By: Intestinal Re: get info from webpage - 04/11/04 01:55 PM
thanks dude.
it works like a charm
© mIRC Discussion Forums