mIRC Home    About    Download    Register    News    Help

Print Thread
Information from Websites #87451 18/06/04 06:28 PM
Joined: Jun 2004
Posts: 8
D
Dominicz Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
D
Joined: Jun 2004
Posts: 8
I'm stuck at the moment.. I've started 'Scripting' and I'm not too good.. I have a question..

Would there be a way for me to make a script that when people say something like "!news" It would go to a website and find the news...

For Example if I wanted it to go to Runescape.com and get the title of the first News Headline and then type it out in the chatroom... any ideas?

Re: Information from Websites #87452 18/06/04 07:00 PM
Joined: Aug 2003
Posts: 314
S
Sigh Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2003
Posts: 314
This can be accomplished through use of sockets on mIRC, you basically need to open a socket to the web server and request the information through HTTP specific commands. You may find it useful to read this tutorial on data retrieval using sockets as it contains information relevant to finding the solution to your problem:

http://www.mircscripts.org/showdoc.php?type=tutorial&id=1217

Re: Information from Websites #87453 18/06/04 07:01 PM
Joined: Jun 2004
Posts: 8
D
Dominicz Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
D
Joined: Jun 2004
Posts: 8
Ok, Thanks!

Re: Information from Websites #87454 18/06/04 07:05 PM
Joined: Dec 2002
Posts: 144
D
Dana Offline
Vogon poet
Offline
Vogon poet
D
Joined: Dec 2002
Posts: 144
Yes, it's quite possible but you'd need to learn how to use sockets.

Jagfire's tutorial should be able to help you.


"Any sufficiently advanced technology is indistinguishable from magic." - Arthur C. Clarke
Re: Information from Websites #87455 19/06/04 06:42 AM
Joined: Jun 2004
Posts: 8
D
Dominicz Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
D
Joined: Jun 2004
Posts: 8
I've looked over the tutorials and tried to make one.. I've come up with this but when I type /playing nothing happens..

alias Playing sockopen Playing www.runescape.com 80

on *:sockopen:Playing:{
sockwrite -n $sockname GET / HTTP/1.1
sockwrite -n $sockname Host: www.runescape.com $+ $crlf $+ $crlf

}

on *:sockread:Playing:{
if ($sockerr) {
echo -a Error.
halt
}
else {

var %temptext

sockread %temptext
if (<span style="font-size:14px; color:white;">There are currently * people playing! isin %temptext) { set %EK $htmlfree(%temptext) }
{ /msg #blehtesting %EK }
}
}
}

any thoughts?

Re: Information from Websites #87456 23/06/04 11:26 AM
Joined: Feb 2003
Posts: 33
G
Gods_Hell Offline
Ameglian cow
Offline
Ameglian cow
G
Joined: Feb 2003
Posts: 33
Code:
on *:sockopen:Playing:{ 
  sockwrite -nt $sockname GET $+(/aff/runescape/title.html) HTTP/1.1 
  sockwrite -nt $sockname Accept-Language: en-us
  sockwrite -nt $sockname User-Agent: Mozilla/??
  sockwrite -nt $sockname Host: www.runescape.com
  sockwrite -nt $sockname Proxy-Connection: Keep-Alive
  sockwrite -nt $sockname Connection: Keep-Alive
  sockwrite -t $sockname $str($crlf,2)
} 
on *:sockread:Playing:{ 
  if ($sockerr &gt; 0) { return | /sockclose Playing }
  sockread -f %temptext 
  var %freehtml $htmlfree(%temptext)
  if (*There?are?currently*people?playing!* iswm %freehtml) { /msg #blehtesting %freehtml } 
} 
alias -l htmlfree {
  var %x, %i = $regsub($1-,/(^[^&lt;]*&gt;|&lt;[^&gt;]*&gt;|&lt;[^&gt;]*$)/g,$null,%x), %x = $remove(%x,&amp;nbsp;)
  return %x
}
on *:text:!players:#blehtesting:{
  sockclose Playing
  sockopen Playing www.runescape.com 80
}


should work!