WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

WinInet
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Download a Message directly to a Binary buffer

 Keywords:  Binary buffer message

Question:

Can someone figure out a script (using the wininet extender) that will download a Go Network Message directly into a binary buffer?

Try this URL for example: http://boards.go.com/cgi/espn/request.dll?MESSAGE&room=mlb_sea&id=300000

Answer:


;http://boards.go.com/cgi/espn/request.dll?MESSAGE&room=mlb_sea&id=300000 


;Load the WinInet extender
AddExtender("WWINT34i.DLL")

;Define key values
;Get host name from ACTION= parameter or induce it from Web page viewed
host="boards.go.com"
;Get mainurl also from action line
mainurl="/cgi/espn/request.dll"


;Define output Binary Buffer
bbsize=100000
bb=BinaryAlloc(bbsize)
;Format form data.  First define the formdata variable as a null string
formdata="MESSAGE&room=mlb_sea&id=300000"


;Build GETURL  (unique to the URL-Encoded "GET" type of form)
geturl=strcat(mainurl,"?",formdata)

; Basic web page fetch script
tophandle=iBegin(0,"","")
connecthandle=iHostConnect(tophandle, host, @HTTP, "", "")
datahandle=iHttpInit(connecthandle,"GET",geturl,"", 0)
rslt = iHttpOpen(datahandle, "", 0, 0);
if rslt!=200
      headers=iHttpHeaders(datahandle)
      AskItemList("Rslt=%rslt%",headers,@tab,@unsorted,@single)
endif

bbaddr=IntControl(42,bb,0,0,0)
xx=iReadDataBuf(datahandle,bbaddr,bbsize)
BinaryEODSet(bb,xx)
iClose(datahandle)
iClose(connecthandle)
iClose(tophandle)


;We now have the returned web page.  Since it is just an
;HTML page, we'll just use the users Web Browser to display it.
;debug only
BinaryWrite(bb,"result.html")
BinaryFree(bb)

;Debug only
ShellExecute("result.html","","",@NORMAL,"OPEN")
exit



Article ID:   W14558
Filename:   Download a Message directly to a Binary buffer.txt
File Created: 2001:03:07:09:05:50
Last Updated: 2001:03:07:09:05:50