mIRC Home    About    Download    Register    News    Help

Print Thread
#28346 05/06/03 09:36 PM
Joined: May 2003
Posts: 9
B
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: May 2003
Posts: 9
right firstly i understand sockets perfectly well and have used them for years so no socket tutorial urls pls.

Now my prob I was trying to query data off www.scriptsbots.co.uk/news.php

so i go through the usual socket stuff except i get a response saying that the page doesn't exist, this is the same for every page on that host. Any ideas :S

BOB

#28347 05/06/03 09:41 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
How about you give us the query you are sending? It is very hard to help you out when you don't give us any code or anything.

#28348 05/06/03 09:42 PM
Joined: May 2003
Posts: 730
S
Hoopy frood
Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
show us your code

#28349 05/06/03 09:44 PM
Joined: May 2003
Posts: 9
B
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: May 2003
Posts: 9
:S soz

on *:sockread:securesite:{
sockread %chantemp
echo -a %chantemp
unset %chantemp
}

on *:sockopen:securesite:{
sockwrite -n $sockname GET /news.php HTTP/1.0
sockwrite -n $sockname $crlf
}

alias securesite {
sockopen securesite www.scriptsbots.co.uk 80
}

works with every site I try except this 1
:S

BOB

#28350 05/06/03 09:46 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
try:
on *:sockopen:securesite:{
sockwrite -n $sockname GET /news.php HTTP/1.0
sockwrite -n $sockname Host: www.scriptsbots.co.uk
sockwrite -n $sockname $crlf
}

#28351 05/06/03 09:49 PM
Joined: May 2003
Posts: 9
B
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: May 2003
Posts: 9
bingo -- n1 , now i just gotta get me m8 to fix his site, to many blank lines :S

thx

#28352 05/06/03 09:50 PM
Joined: May 2003
Posts: 730
S
Hoopy frood
Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
and if still doesn't work try HTTP/1.1

#28353 06/06/03 05:16 AM
Joined: May 2003
Posts: 79
A
Babel fish
Offline
Babel fish
A
Joined: May 2003
Posts: 79
Like this it will work. It won't show all the blank lines, and it works :P

alias securesite { sockclose securesite | sockopen securesite scriptsbots.co.uk 80 }
on *:sockopen:securesite:{
if (!$sockerr) {
sockwrite -n $sockname GET /news.php HTTP/1.1
sockwrite -n $sockname Host: scriptsbots.co.uk $str($crlf,2)
}
}
on *:sockread:securesite:{
sockread %securesite
if (%securesite) { echo -a %securesite }
}

#28354 06/06/03 05:46 AM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
i myself prefer writing the reads to a txt file so i can be sure to have the whole file, and also just makes it easier for parsing. Usually on a webpage, things like "news always begin at line 120" kind of patters are easier to handle. Just an idea--

if you would like it in a file, try this for the read:

on 1:SOCKOPEN:*: {
if ($sockerr) /echo -a Error: $sockname
else {
; your socket writes
if ($isFile(data.txt)) .remove data.txt
}
}

on 1:SOCKREAD:*: {
/sockread -f &data
/bwrite data.txt -1 -1 &data

}

on 1:SOCKCLOSE:*: {
; all your parsing here
}

the red part is what is important. The rest is just to give you the idea of where it should be placed.


-KingTomato

Link Copied to Clipboard