mIRC Home    About    Download    Register    News    Help

Print Thread
get info from webpage #102091 04/11/04 01:28 PM
Joined: Oct 2004
Posts: 8
I
Intestinal Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
I
Joined: Oct 2004
Posts: 8
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.


irc is just multiplayer notepad!
Re: get info from webpage #102092 04/11/04 01:38 PM
Joined: Dec 2002
Posts: 788
C
Coolkill Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 788
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.

Re: get info from webpage #102093 04/11/04 01:55 PM
Joined: Oct 2004
Posts: 8
I
Intestinal Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
I
Joined: Oct 2004
Posts: 8
thanks dude.
it works like a charm


irc is just multiplayer notepad!