read excel with socket? - 12/01/03 07:58 AM
Can you read data from a spreadsheet on a website using a socket?
If so, how?
If so, how?
alias excel { [color:green]; Close the socket if already open.[/color] sockclose excel [color:green]; Open a socket connection[/color] sockopen excel asx.com.au 80 } On *:sockopen:excel:{ [color:green]; Clear destination file[/color] write -c file.xls [color:green]; Send HTTP request[/color] sockwrite -tn excel GET /programs/Vols&Divs.xls HTTP/1.0 sockwrite -tn excel Accept: */* *.* sockwrite -tn excel Connection: close sockwrite -tn excel Host: asx.com.au sockwrite -tn excel } On *:sockread:excel:{ [color:green]; As you probably know, the server sends ; some header information prior to the file data. ; ; We've gotta filter that header, as including it ; in the file would corrupt it. ; ; Here I mark the socket once the header ends ; to know whether we can start writing into the file.[/color] if !$sock(excel).mark { [color:green]; If the socket isn't marked yet, read the data to a mIRC variable.[/color] var %var sockread %var [color:green]; Then check its content. ; empty variable represents the header ending.[/color] if %var == $null { sockmark excel 1 } } else { sockread &var bwrite file.xls -1 &var } } On *:sockclose:excel:{ [color:green]; Now that the server closed the connection ; the file is ready for use.[/color] run file.xls }