mIRC Home    About    Download    Register    News    Help

Print Thread
#225175 27/08/10 09:49 AM
G
GreyStar
GreyStar
G

I have pasted a small peace of a php file below. Im using SocketOpen SocketRead and Im able to open and read the file but the peace / line in the file I need is not being read.

Any reason why? I have bolded the line Im not seeing with SocketRead


?>
<h1>Currently Active Channels</h1><p>If you are using mIRC, or any other client which supports the <tt>irc://</tt> protocol, then clicking on the mIRC icon will make your client join the chosen channel on StarChat. Otherwise, clicking on the channel name will load our Java chat client. Happy chatting!</p>
<p>Last update: Fri Aug 27 09:15:28 2010 GMT.</p><table class="chanList">
<tr align="left"><th> </th><th>Channel Name</th><th>Users</th><th>Topic</th></tr>
<tr>

#225183 27/08/10 04:46 PM
Joined: Jul 2007
Posts: 1,124
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,124
You can try using regex:
Code:
on *:sockread:yoursockname:{
  var %x 
  sockread %x
  if ($regex(%x,/<p>(.+)</p><table class="chanList">/)) {
    echo -a $regml(1)
    sockclose $sockname
  }
This is just a rough suggestion, as I have no idea what your socket script looks like.

Tomao #225189 27/08/10 09:53 PM
G
GreyStar
GreyStar
G
This is what I have, very simple simon

Code:
 

alias /testspy /sockopen chanspy www.starchat.net 80

on *:sockopen:chanspy:{ 
  sockwrite -n $sockname GET /channels.php HTTP/1.1
  sockwrite -n $sockname Host: starchat.net $+ $crlf $+ $crlf

}

on 1:sockread:chanspy:{
  if ($sockerr > 0) return
  :nextread
  sockread %temp
  if ($sockbr == 0) return
  if (%temp == $null) %temp = -
  echo -a  %temp
  goto nextread
}


#225210 28/08/10 06:05 AM
Joined: Jul 2007
Posts: 1,124
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,124
The code below will print out
Quote:
Last update: Sat Aug 28 06:03:02 2010 GMT.
Code:
alias testspy {
  sockclose chanspy
  sockopen chanspy www.starchat.net 80
}
on *:sockopen:chanspy:{ 
  sockwrite -n $sockname GET /channels.php HTTP/1.1
  sockwrite -n $sockname Host: starchat.net $+ $crlf $+ $crlf
}
on 1:sockread:chanspy:{
  var %temp
  sockread %temp
  if ($regex(%temp,/<p>(Last update\:\s.+)</p>/i)) {
    echo -a $regml(1)
    sockclose $sockname
  }
}

Tomao #225212 28/08/10 06:16 AM
G
GreyStar
GreyStar
G


Doesnt for me, I get no echo's
But thank you for taking time with this

Cheers mate

#225213 28/08/10 06:18 AM
Joined: Jul 2007
Posts: 1,124
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,124
That's certainly odd. It's worked for me when I tested it.

By the way, I'm running the latest version of mIRC.

#225216 28/08/10 08:04 AM
U
unable
unable
U
Hi. Is there html code:
Code:
<!-- Full Profile -->
<div class="hide" id="fullprofile">
	<!-- Start double information -->
	<div class="d1-1-2-6">
		<div class="d1-1-2-6-1 info_line">
			<div class="info_name">Name1</div>
			<div class="info_value">Value1</div>
		</div>
		<div class="d1-1-2-6-2 info_line">
			<div class="info_name">Name2</div>
			<div class="info_value">Value2</div>
		</div>
		<div class="d1-1-2-6-3 info_line hide">
			<div class="info_name">Name3</div>
			<div class="info_value">Value3</div>
		</div>
...
       </div>
</div>


Prompt please how to get cut to make it:
Name1 - Value1
Name2 - Value2
Name3 - Value3
....
Thnx

Tomao #225228 28/08/10 09:00 PM
G
GreyStar
GreyStar
G


I downloaded and installed 7.1 and everything is peachy. My original works as well as yours.

Thanks again for your time


Link Copied to Clipboard