Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
; This takes the HTTP data submitted from a web page and saves it for the user... ; ; I was testing WinHTTrack's ability to capture data from a web/page/form and ; save it to a file and thought it might be handy for Winbatch users getting ; into WinInet and the web opus, about how/what/which data they might need to ; encode and send via their scripts. So I borrowed that idea and Kirby's excellent ; Screenshot Server Script to build something 95% Winbatch. ; ; Feel free to test and let me know if it works for you. So far, so good for me. ; ; attached is the sample output from capturing the form for the Winbatch BBS login. ; I got it to work with Google too. ; ; Step 1: make sure you have an internet connection ; ; Step 2: start your browser and navigate to the web page or form you need to ; get information from. ; ; Step 3: open your browser's settings to use a Manual Proxy and set the ; Proxy IP to your PC's IP and the port to 8080. In Firefox you can use the radio ; buttons to move between this and a direct internet connection without having to ; retype each time. ; ; Step 4: Start this script. ; ; Step 5: fill out the form and press whatever the submit button/image, etc as normal ; to send the data. Be patient. ; ; Step 6: Your browser will get back a page that shows the HTTP header text + the ; binary informtion of the form, inside a TEXTAREA (so you can copy & paste it into ; a file to work with). See attached below. ; ; Hit BACK on your browser each time and you can test it again. ; ; Step 7: Exit this script. ; ; Step 8: Reset your browser's Proxy Info to the way it was before and you're done! ; ; ; Jay Alverson, Winbatch 2007C ; AddExtender("wwwsk44i.dll") AddExtender("wwipg34i.dll") cname = Environment("COMPUTERNAME") ipaddr=ipHost2Addr(cname,15) ; ClipPut(ipaddr) ; If !AskYesNo("HTTP Intercept", "Keep going?") Then Exit ; answer NO if you just need your IP... ; portnumber = 8080 ; title = "HTTP Data Saver" ; BoxesUp("650 800 999 950",@NORMAL) BoxTitle(title) BoxButtonDraw(1,1,"Exit","000 500 999 999") ; listensocket=sOpen() sListen(listensocket,portnumber) Served=0 While 1 datasocket=sAccept(listensocket,@FALSE) ; NO Block for a connection If datasocket GoSub ProcessRequest Else err = wxGetLastErr() If err != @SERRNOCONN sClose(listenSocket) Message("Socket Error %err%",wxGetErrDesc(err)) Exit EndIf EndIf TimeDelay(1.0) If BoxButtonStat(1,1) Then Goto CANCEL EndWhile Exit ; :CANCEL sClose(listenSocket) BoxText("Normal exit.") TimeDelay(0.5) Exit ; ; :ProcessRequest ; Served=Served+1 ; rqst = sRecvLine(datasocket,256) While @TRUE ThisLine = sRecvLine(datasocket,256) If ThisLine == Num2Char(0) Then Break ; no more text data... rqst = StrCat(rqst, ThisLine, @CRLF) EndWhile ; ;clipput(rqst) ; bsize = 1000 ;<-- change this to something larger if you're sending a huge amount of data... binbuf = BinaryAlloc(bsize) BinaryEodSet(binbuf,bsize) ; binaddr = IntControl(42,binbuf,0,0,0) stuff = sRecvBinary(datasocket, binaddr, bsize) bdata = BinaryPeekStr(binbuf,0,bsize) BinaryFree(binbuf) ; rqst = StrCat(`<h3>HTTP Data from browser:</h3><textarea cols="100%%" rows="20" style="overflow:auto;padding:5mm;">`, rqst, @CRLF, @CRLF, bdata, "</textarea>") ; now = TimeDate() sSendLine(datasocket,"HTTP/1.1 200 OK") sSendLine(datasocket,StrCat("Date: ",now)) sSendLine(datasocket,StrCat("Expires: ",now)) sSendLine(datasocket,StrCat("Content-Type: ","text/html")) sSendLine(datasocket,StrCat("Content-Length: ",StrLen(rqst))) sSendLine(datasocket,"") sSendString(datasocket, rqst) sClose(datasocket) ; BoxText(StrCat("served: ", served, " at: ",now)) BoxTitle(StrCat(title," ", served)) ; Return
Article ID: W17382
File Created: 2012:11:01:08:46:26
Last Updated: 2012:11:01:08:46:26