mIRC Home    About    Download    Register    News    Help

Print Thread
#16771 24/03/03 10:01 PM
Joined: Mar 2003
Posts: 437
M
MTech Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Mar 2003
Posts: 437
how do i open, read and close sockets so i can read a webpage for information?

im not good with sockets, and the help file just keeps confusing me more and more everytime i go over it...


sum 1 please help!

#16772 25/03/03 01:24 AM
Joined: Mar 2003
Posts: 31
G
GBX Offline
Ameglian cow
Offline
Ameglian cow
G
Joined: Mar 2003
Posts: 31
simple example script
Code:
alias heise {
  sockclose heise
  sockopen heise heise.de 80
}
on 1:sockopen:heise:{
; GET <url> HTTP/1.1
  sockwrite -n $sockname GET / HTTP/1.1        
  sockwrite -n $sockname Host: www.heise.de
  sockwrite -n $sockname $crlf
}
on 1:sockread:heise:{
  sockread %sockread
  echo %sockread
}


read through /help sockets to find out the rest

#16773 25/03/03 02:15 AM
Joined: Mar 2003
Posts: 437
M
MTech Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Mar 2003
Posts: 437
i cant get that to work...

#16774 25/03/03 03:08 AM
Joined: Dec 2002
Posts: 1,527
_
Hoopy frood
Offline
Hoopy frood
_
Joined: Dec 2002
Posts: 1,527
lol thats an example script ..... one togive u a slight map to go by when setting up ur own ........ its missing several checks like it leaves the sock open after u read from it ...... doesnt account for an error ....... minor lil things like that ... but if ur interested in some sort of reading from a site using sockets use the search feature look for SOCKETS expand the date range for somewhere around 6 months ..... and look for a few of the posts by Hammer ..... hes done a few excellant example scripts and explains them very well


D3m0nnet.com
#16775 25/03/03 03:28 AM
Joined: Mar 2003
Posts: 437
M
MTech Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Mar 2003
Posts: 437
im sorry but i just cant find anything that even looks simple enough for me to edit...

please help

i just need a socket to open http://www.whitehouse.gov/homeland/index.html and see if different text strings are in that site and then if so run ome mirc commands

#16776 25/03/03 12:04 PM
Joined: Mar 2003
Posts: 31
G
GBX Offline
Ameglian cow
Offline
Ameglian cow
G
Joined: Mar 2003
Posts: 31
i wrote this in 2 mins and i wanted it as small as possible
socks do not need to be closed, mirc does this automatically

#16777 25/03/03 12:20 PM
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
No it doesn't. mIRC never closes sockets without being told to, it will be the server on the other end closing the connection.

#16778 25/03/03 12:26 PM
Joined: Mar 2003
Posts: 31
G
GBX Offline
Ameglian cow
Offline
Ameglian cow
G
Joined: Mar 2003
Posts: 31
yes, you re right
it's some time ago i read thru sockets

#16779 25/03/03 10:07 PM
Joined: Dec 2002
Posts: 1,527
_
Hoopy frood
Offline
Hoopy frood
_
Joined: Dec 2002
Posts: 1,527
man how come u had to slam me for being right ..... lol thats just wrong ..... u owe me a cookie now ..... hahaha ...... jk i wasnt tryin to slam on ur example as i do know u tossed it together really quickly to give an example to him ....... i was tryin to show him that he couldnt just edit that one there to get his info from ...... most of the time u can edit like 2 lines on a socket script and bam there u go it does what ur looking for but what hes looking for is a lil more complex since i think hes trying to find a specific line in the webpage hes looking for then return that line into a variable for a set in a dialog box ..... now only way i know of doing that is if u know what the specific line may read ur looking for is to loop thru the %version returned from the socket read until it finds a match ... then sets that to a variable ..... once it matches it then neds to close the socket open un a dialog menu u create and then read the line stored from ur variable ..... again thats how id go about finding that .. thats actually how i did my update script ... because for some screwed up reason it stopped working the way it was supposed to and started returning http200/ok and the whole mess of lines there as the %version for my updater script and then since it didnt match it just simply siad ok u need an update ........ anyhow long story but thats old news


D3m0nnet.com

Link Copied to Clipboard