This code will consider every (non-blank) line after the end of the headers to be a quote.
on *:TEXT:!quotes:#:showquote
alias showquote {
if ($event == text) set %qm msg $chan
else set %qm echo -a
unset %nextline
if ($hget(quotes)) hfree quotes
hmake quotes 5
if ($sock(q)) sockclose q
sockopen q www.sith-net.com 80
.timer 1 5 sockclose q
}
on *:SOCKOPEN:q:{
if ($sockerr) {
echo -s Error: couldn't contact website1.
return
}
sockwrite -tn q GET /f4c/Quotes.php HTTP/1.0
sockwrite -tn q Host: www.sith-net.com
sockwrite -tn q
}
on *:SOCKREAD:q:{
var %s
sockread %s
;echo 7 -s > %s
if ((%s == $null) && (!%nextline)) { set %nextline 1 }
elseif ((%nextline) && (%s != $null)) {
hadd quotes %nextline %s
inc %nextline
}
}
on *:SOCKCLOSE:q:{
var %rand = $r(1,$hget(quotes,0).item)
%qm $hget(quotes,%rand)
unset %nextline, %qm
if ($hget(quotes)) hfree quotes
}
If the webpage has one line, that line will always be shown. If the webpage has multiple quotes on multiple lines, all of the lines will be read and a random one will be chosen and sent.
If the /showquote command is entered manually, the quote will be echo'd to the active window. If someone types !quotes in any channel, the quote will be msg'd to that channel.
-genius_at_work