mIRC Home    About    Download    Register    News    Help

Print Thread
#16871 25/03/03 05:10 PM
Joined: Jan 2003
Posts: 148
K
Knappen Offline OP
Vogon poet
OP Offline
Vogon poet
K
Joined: Jan 2003
Posts: 148
I`ve posted this one before, but I didn`t get any reply so I try again..

I have this test socket:

alias update {
sockclose script.update
sockopen script.update www.home.no 80
}

on *:sockopen:script.update:{
sockwrite -n $sockname GET /knappen/version.txt HTTP/1.1
sockwrite -n $sockname Host: www.home.no
sockwrite -n $sockname $crlf
}

on *:sockread:script.update:{
var %ver
sockread %ver
tokenize 32 %ver
if (%ver) { echo -a %ver }
}

This is just a simple test for me to learn how to make a socket update... But when i try it it echoes:

HTTP/1.1 200 OK
Date: Sat, 22 Mar 2003 11:34:37 GMT
Server: Apache/2.0.43 (Unix) mod_ssl/2.0.43 OpenSSL/0.9.6g
Last-Modified: Sun, 09 Mar 2003 16:35:16 GMT
ETag: "e2c098-4-b402d900"
Accept-Ranges: bytes
Content-Length: 4
Content-Type: text/plain; charset=ISO-8859-1

What is wrong? It should return v1.0 . I`ve placed a text file on my site that only contains v1.0.. But why doesn`t it echo that out?

Thanx for any help!

#16872 26/03/03 09:51 AM
Joined: Dec 2002
Posts: 191
N
Vogon poet
Offline
Vogon poet
N
Joined: Dec 2002
Posts: 191
This returns the line you wanted.
Code:

on *:sockread:script.update:{
  var %ver
  :loop
  sockread -f %ver
  if (!$sockbr) return
  if (!%ver) %ver = -
  if (v*.* iswm %ver) echo -ag %ver
  goto loop
}

#16873 26/03/03 01:48 PM
Joined: Jan 2003
Posts: 148
K
Knappen Offline OP
Vogon poet
OP Offline
Vogon poet
K
Joined: Jan 2003
Posts: 148
Thanx man! It works! But why wouldn`t it work with my coding??

#16874 27/03/03 07:02 AM
Joined: Dec 2002
Posts: 191
N
Vogon poet
Offline
Vogon poet
N
Joined: Dec 2002
Posts: 191
From the help file.

If you specify the -f switch with a %var variable, this forces mIRC to fill the %var variable with whatever text is in the receive buffer, even if it doesn't end in a CRLF.


#16875 27/03/03 04:05 PM
Joined: Jan 2003
Posts: 148
K
Knappen Offline OP
Vogon poet
OP Offline
Vogon poet
K
Joined: Jan 2003
Posts: 148
What the....? I did do that many times to try it but I got the same echo... Strange... Well, Thanks for your help! smile


Link Copied to Clipboard