mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2004
Posts: 17
S
Pikka bird
OP Offline
Pikka bird
S
Joined: May 2004
Posts: 17
I have a socket connect to a web page and I want to diplay a line from that page in chan.
With this code I retrieve the whole page (and the script exit for excess flood);

on *:sockread:mySockName:{
if ($sockerr > 0) return
:nextread
else {
sockread -f %scasttemp
if ($sockbr == 0) return
if (%scasttemp == $null) %scasttemp = empty
msg $active %scasttemp

}
}

Instead I want display only a single line from the middle of the web page, this line

<font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#464646"><small>
I_WAS_LOOKING_FOR_THIS_LINE<br>
</small></font>

Can someone help me? Thanks!

Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Code:
on *:sockread:mySockName:{
if ($sockerr &gt; 0) return 
:nextread 
else {
sockread -f %scasttemp
if ($sockbr == 0) return
if (%scasttemp == $null) %scasttemp = empty
if (%scasttemp == &lt;font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#464646"&gt;&lt;small&gt;I_WAS_LOOKING_FOR_THIS_LINE&lt;br&gt;&lt;/small&gt;&lt;/font&gt;) {  msg $active %scasttemp }
}
}  


New username: hixxy
Joined: May 2004
Posts: 17
S
Pikka bird
OP Offline
Pikka bird
S
Joined: May 2004
Posts: 17
Thanks tidy_trax for your reply, I have a more complex problem though, that line is a dinamic one and change over a user post. I have done this:

on *:sockread:SitoEthnic:{
if ($sockerr > 0) return
:nextread
else {
sockread -f %scasttemp
if ($sockbr == 0) return
if (%scasttemp == $null) %scasttemp = empty
if (%scasttemp == <font size="2" face="Verdana, Arial, Helvetica, sans-serif" color="#464646"><small>*<br></small></font>iswm %scasttemp) { msg $active %scasttemp }
}
}

I have added a wildcard but it doesn't work yet, please help me frown
Thanks

Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Missing space: ...<br></small></font>iswm %scasttemp)...
...<br></small></font> iswm %scasttemp)...

Joined: May 2004
Posts: 17
S
Pikka bird
OP Offline
Pikka bird
S
Joined: May 2004
Posts: 17
thanks for yuor reply, it doesn't work even fixing that space. I will try something other. Thanks frown

Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Can you please tell us the address of the page?

Joined: May 2004
Posts: 17
S
Pikka bird
OP Offline
Pikka bird
S
Joined: May 2004
Posts: 17
sorry, the page is a test one on my hard disk, I have put it on my web server and is always off-line.
I have tried now this code:
Quote:

on *:sockread:MySocket:{
if ($sockerr > 0) return
else {
:nextread
sockread -f %scasttemp
if ($sockbr == 0) return
if (%scasttemp == $null) %scasttemp = empty
set %scasttemp $gettok(%scasttemp,9-,44)
msg $active %scasttemp
}
}


There are 2 problems, if I change the gettok to 10 or above it display nothing even if there are 38 commas ;(
example $gettok(%scasttemp,10-,44) <---- display nothing
Maby not the whole raw code was read in the %scasttemp?

Thanks (sorry for my bad english)

Joined: May 2004
Posts: 17
S
Pikka bird
OP Offline
Pikka bird
S
Joined: May 2004
Posts: 17
The gettok stop read here
Quote:


<html>

<head>
<title>Site Name</title>
<style>
<!--
body { font-family: Arial, Helvetica, sans-serif; color : gray; }
A { text-decoration : none; color : teal; }
A:Hover { text-decoration : underline; color : teal; }
-->
</style><script language="JavaScript1.2">function songinfo(songID)
{
songwin = window.open("songinfo.php?songID="+songID, "songinfowin", "location=no,status=no,menubar=no,scrollbars=yes,resizeable=yes,height=400,width=650");
}</script>


While the next code is
Quote:

<script language='JavaScript1.2' src='http://www.audiorealm.com/player/player.js.html?srefID=1&subscription=no'></script>
<script language='JavaScript1.2'>function request(songID)
{
reqwin = window.open("req.php?songID="+songID, "_AR_request", "location=no,status=no,menubar=no,scrollbars=no,resizeable=yes,height=420,width=668");
}
</script>
</head>

<body>

<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="1%" align="center"><a href="playing.php"><img border="0" src="images/logo.gif"></a><br>
<img border="0" src="images/spacer.gif" width="15" height="13"></td>
<td width="99%" valign="middle" align="left"><b><font size="5"> &nbsp; Site Name ;D</font></b></td>
</tr>
<tr>
<td width="100%" colspan="2" bgcolor="#000080"><img border="0" src="images/spacer.gif" width="1" height="1"></td>
</tr>
</table>


And the html code is still continue...but the code after the javasrcipt1.2 tags is not countend frown


Link Copied to Clipboard