mIRC Homepage
Posted By: Deep3D "news" - 30/04/03 03:40 PM
ok, if i have a news.txt file on my web page.. and every time the script starts it wold check this file.. and do a //echo <text in news.txt-file> confused
Posted By: MonoSex Re: "news" - 30/04/03 04:10 PM
/help sockets or use search.
Posted By: Deep3D Re: "news" - 30/04/03 04:27 PM
erm.. i have tryed that..
Posted By: Knappen Re: "news" - 30/04/03 04:29 PM
alias news {
sockclose news.read
sockopen news.read www.yourwebpage.com 80
}

on *:sockopen:news.read:{
if ($sockerr) { echo -a *** Cannont retrive news... | halt }
sockwrite -n $sockname GET news.txt HTTP/1.1
sockwrite -n $sockname Host: www.yourwebpage.com
sockwrite -n $sockname $crlf
}

on *:sockread:news.read:{
var %news
sockread -f %news
if ($sockbr) echo -a %news
}
Posted By: Deep3D Re: "news" - 30/04/03 04:43 PM
HTTP/1.1 200 OK
Date: Wed, 30 Apr 2003 17:14:52 GMT
Server: Apache/2.0.40 (Win32)
Last-Modified: Wed, 30 Apr 2003 15:57:34 GMT
ETag: "30a2-12-3ceef780"
Accept-Ranges: bytes
Content-Length: 18
Content-Type: text/plain; charset=ISO-8859-1

FFS?
Posted By: codemastr Re: "news" - 01/05/03 02:48 AM
Well don't expect him to do it 100% for you, he gave you perfectly workable code, it simply needs to be modified somewhat.
Posted By: KingTomato Re: "news" - 01/05/03 03:21 AM
menu channel {
Get News: /sockopen news home.no 80
}

on 1:SOCKOPEN:news: {
if ($sockerr) {
/beep 5 100
/did -ra kt_scast 40 Server Is Down
}
else {
/sockwrite -n $sockname GET /reactor/news.txt HTTP/1.0
/sockwrite -n $sockname Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
/sockwrite -n $sockname Accept-Language: en-us
/sockwrite -n $sockname Accept-Encoding: gzip, deflate
/sockwrite -n $sockname User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)
/sockwrite -n $sockname Host: $sock(shout).ip $+ : $sock(shout).port
/sockwrite -n $sockname Connection: Keep-Alive
/sockwrite -n $sockname
}
if ($isFile(news.txt)) { .remove news.txt }
}

on 1:SOCKREAD:news: {
/sockread -f 5000 &news
/bwrite news.txt -1 -1 &news
}

on 1:SOCKCLOSE:news: {
/set -u0 %lastupdate $gettok($read(news.txt, 4), 2, $asc(:))
/echo -a NEWS (Posted On %lastupdate $+ ): $read(news.txt, $lines(news.txt))
}
Posted By: codemastr Re: "news" - 01/05/03 03:30 AM
/sockwrite -n $sockname Host: $sock(shout).ip $+ : $sock(shout).port

According to RFC2616, that line is invalid. You are not supposed to specify the IP in the host header. And even if you could, it would be utterly pointless seeing as how the server already knows the IP you connected on. You are supposed to specify the HOST (not IP) that you connected to, ie, mirc.com not 209.240.130.48. Also, since you connected to port 80, specifying the port in the Host header is redundant since port 80 is assumed by default.
Posted By: KingTomato Re: "news" - 01/05/03 04:21 AM
your right
i took it from a script b4 when I was learnign how. I never removed the line, and therefor it exists.
Posted By: KingTomato Re: "news" - 02/05/03 03:19 AM
I see the news script it working well, Deep >:D

NEWS (Posted On Thu, 01 May 2003 17): Reactor 1.5 is under construction. It's going to be really good! smile
Posted By: Deep3D Re: "news" - 02/05/03 03:41 PM
hehe, yezz.. smile
© mIRC Discussion Forums