I have been trying to use mIRC to read a short line of text from a url and echo/ write it in to chat when someone types !test.
The socket host is XXXXXXXXXXXX because it is running on wamp on my PC.
The data on the page is not long, Here is the page.
SnOwEfLaKe's Battlefield 4(pc) Stats | Rank: 140 | Kills: 66393 | K/D: 2 | W/L: 1.38 | Score: 60646533 | Time Played: 53.27 days | Accuracy: 14.17%
alias demo {
var %user = $$1, %chan = $2, %sockname = demo. $+ $ticks
hfree -w %sockname | hmake %sockname
hadd %sockname user %user
hadd %sockname chan %chan
hadd %sockname host XXXXXXXXX
hadd %sockname port 80
hadd %sockname request /nb/bf4stats.php
sockopen -e %sockname $hget(%sockname,host) $hget(%sockname,port)
}
on *:text:!test:#:{
demo #
}
on *:sockopen:demo.*: {
var %<< = sockwrite -nt $sockname
%<< GET $hget($sockname,request) HTTP/1.0
%<< Host: $sock($sockname).addr
%<< $crlf
}
on *:sockread:demo.*: {
var %header, %content
if (!$hget($sockname,header.complete)) {
sockread %header
while (%header != $null) {
if (HTTP/* 2?? * iswm %header) { hadd $sockname following $true }
elseif (HTTP/* 4?? * iswm %header) { hadd $sockname following $false }
;echo -ag %header
sockread %header
}
if ($sockbr) hadd $sockname header.complete $true
}
if ($hget($sockname,header.complete)) {
while ($sockbr) {
sockread -f %content
;if (%content != $null) echo -ag %content
}
}
}
on *:sockclose:demo.*:{
if ($hget($sockname,following)) { var %msg = Following }
else { var %msg = Not following }
if ($hget($sockname,chan)) { msg $v1 %msg }
else { echo -ag %msg }
hfree $sockname
}
I am not having any luck
I figured out how to do it.
And after that I have a JSON Parser that I have gotten from here: http://hawkee.com/snippet/10194