I've been trying to fix, re-fix, re-write, re-re-write and re-fix this script for some days now and i can not figure out why i can't get the name out of the HTML:
alias somealias {
sockopen somealias some.com 80
set %playerid $1-
set %host_url /host.php?id= $+ %playerid
}
on *:SOCKOPEN:somealias: {
sockwrite -n $sockname GET %host_url HTTP/1.1
sockwrite -n $sockname Host: somehost.com
sockwrite -n $sockname Connection: Keep-Alive
sockwrite -n $sockname $crlf
}
on *:sockread:somealias:{
if ($sockerr > 0) return
var %temptext | sockread %temptext
if (<img src="hlstatsimg/flags/.*\.gif" style="border:0px;" alt=".*" title=".*">\ <b>.*</b> iswm %temptext) { echo -a %temptext }
}
on *:sockread:somealias:{
if ($sockerr > o) return
sockread %temptext
var %tmpexp <img src="hlstatsimg/flags/.*\.gif" style="border:0px;" alt=".*" title=".*"> <b>(.*)<\/b>
if ($regex(%temptext, %tmpexp)) { echo -a $regml(1)
}
unset %playerid
unset %host_url
sockclose somealias
}
I've edited out the alis names, web host and stuff.
What i am trying to do is:
Get Player ID from input (ex: /somealias 528 for id 528)
Add it to the host url as page.php?playerid=528
That works fine.
Then I am taking all the HTML from the page, looking for the line that includes <img .. flag/(flag_name_here).gif> alt="country name" title="country name">
<b>My name(in this case z4nd)</b>
that seems to be in %temptex, but i can not get the reg-ex functions to work and find the data i need to echo out (doesn't have to spam the channel, but can change that later on)
How do i remove the html, get the name and echo it all out?
I've been reading up on reg-ex and mirc reg-ex functions, looking at other scripts and all kind of suff, but can't seem to get it right.
Sockets really is my nemesis.
Side question (can look into that later, doesn't have to be answered): Would it be possible to make it into a small function, so i can take whatever data i need?
like Name, rank, points, as long it's on the site.