mIRC Home    About    Download    Register    News    Help

Print Thread
"news" #21660 30/04/03 03:40 PM
Joined: Dec 2002
Posts: 476
Deep3D Offline OP
Fjord artisan
OP Offline
Fjord artisan
Joined: Dec 2002
Posts: 476
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

Re: "news" #21661 30/04/03 04:10 PM
Joined: Dec 2002
Posts: 395
M
MonoSex Offline
Fjord artisan
Offline
Fjord artisan
M
Joined: Dec 2002
Posts: 395
/help sockets or use search.

Re: "news" #21662 30/04/03 04:27 PM
Joined: Dec 2002
Posts: 476
Deep3D Offline OP
Fjord artisan
OP Offline
Fjord artisan
Joined: Dec 2002
Posts: 476
erm.. i have tryed that..

Re: "news" #21663 30/04/03 04:29 PM
Joined: Jan 2003
Posts: 148
K
Knappen Offline
Vogon poet
Offline
Vogon poet
K
Joined: Jan 2003
Posts: 148
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
}

Re: "news" #21664 30/04/03 04:43 PM
Joined: Dec 2002
Posts: 476
Deep3D Offline OP
Fjord artisan
OP Offline
Fjord artisan
Joined: Dec 2002
Posts: 476
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?

Last edited by Deep3D; 30/04/03 05:16 PM.
Re: "news" #21665 01/05/03 02:48 AM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Well don't expect him to do it 100% for you, he gave you perfectly workable code, it simply needs to be modified somewhat.

Re: "news" #21666 01/05/03 03:21 AM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
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))
}


-KingTomato
Re: "news" #21667 01/05/03 03:30 AM
Joined: Dec 2002
Posts: 2,809
C
codemastr Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
/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.

Re: "news" #21668 01/05/03 04:21 AM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
your right
i took it from a script b4 when I was learnign how. I never removed the line, and therefor it exists.


-KingTomato
Re: "news" #21669 02/05/03 03:19 AM
Joined: Jan 2003
Posts: 3,012
KingTomato Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
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


-KingTomato
Re: "news" #21670 02/05/03 03:41 PM
Joined: Dec 2002
Posts: 476
Deep3D Offline OP
Fjord artisan
OP Offline
Fjord artisan
Joined: Dec 2002
Posts: 476
hehe, yezz.. smile