mIRC Home    About    Download    Register    News    Help

Print Thread
#21660 30/04/03 03:40 PM
Joined: Dec 2002
Posts: 483
Deep3D Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Dec 2002
Posts: 483
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

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

#21662 30/04/03 04:27 PM
Joined: Dec 2002
Posts: 483
Deep3D Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Dec 2002
Posts: 483
erm.. i have tryed that..

#21663 30/04/03 04:29 PM
Joined: Jan 2003
Posts: 148
K
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
}

#21664 30/04/03 04:43 PM
Joined: Dec 2002
Posts: 483
Deep3D Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Dec 2002
Posts: 483
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.
#21665 01/05/03 02:48 AM
Joined: Dec 2002
Posts: 2,809
C
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.

#21666 01/05/03 03:21 AM
Joined: Jan 2003
Posts: 3,012
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
#21667 01/05/03 03:30 AM
Joined: Dec 2002
Posts: 2,809
C
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.

#21668 01/05/03 04:21 AM
Joined: Jan 2003
Posts: 3,012
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
#21669 02/05/03 03:19 AM
Joined: Jan 2003
Posts: 3,012
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
#21670 02/05/03 03:41 PM
Joined: Dec 2002
Posts: 483
Deep3D Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Dec 2002
Posts: 483
hehe, yezz.. smile


Link Copied to Clipboard