mIRC Home    About    Download    Register    News    Help

Topic Options
#21660 - 30/04/03 04:40 PM "news"
Deep3D Offline
Fjord artisan

Registered: 09/12/02
Posts: 476
Loc: Norway
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

Top
#21661 - 30/04/03 05:10 PM Re: "news"
MonoSex Offline
Fjord artisan

Registered: 09/12/02
Posts: 395
Loc: Ireland
/help sockets or use search.

Top
#21662 - 30/04/03 05:27 PM Re: "news"
Deep3D Offline
Fjord artisan

Registered: 09/12/02
Posts: 476
Loc: Norway
erm.. i have tryed that..

Top
#21663 - 30/04/03 05:29 PM Re: "news"
Knappen Offline
Vogon poet

Registered: 02/01/03
Posts: 148
Loc: Norway
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
}

Top
#21664 - 30/04/03 05:43 PM Re: "news"
Deep3D Offline
Fjord artisan

Registered: 09/12/02
Posts: 476
Loc: Norway
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?


Edited by Deep3D (30/04/03 06:16 PM)

Top
#21665 - 01/05/03 03:48 AM Re: "news"
codemastr Offline
Hoopy frood

Registered: 12/12/02
Posts: 2809
Well don't expect him to do it 100% for you, he gave you perfectly workable code, it simply needs to be modified somewhat.

Top
#21666 - 01/05/03 04:21 AM Re: "news"
KingTomato Offline
Planetary brain

Registered: 04/01/03
Posts: 3012
Loc: New Hampshire, USA
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

Top
#21667 - 01/05/03 04:30 AM Re: "news"
codemastr Offline
Hoopy frood

Registered: 12/12/02
Posts: 2809
/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.

Top
#21668 - 01/05/03 05:21 AM Re: "news"
KingTomato Offline
Planetary brain

Registered: 04/01/03
Posts: 3012
Loc: New Hampshire, USA
your right
i took it from a script b4 when I was learnign how. I never removed the line, and therefor it exists.
_________________________
-KingTomato

Top
#21669 - 02/05/03 04:19 AM Re: "news"
KingTomato Offline
Planetary brain

Registered: 04/01/03
Posts: 3012
Loc: New Hampshire, USA
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

Top
#21670 - 02/05/03 04:41 PM Re: "news"
Deep3D Offline
Fjord artisan

Registered: 09/12/02
Posts: 476
Loc: Norway
hehe, yezz.. smile

Top