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.

Post HTML Problem


Question:

I am having some difficulty with a website that just updated. My code is similar to some that works on another part of the site, but I cannot get this page to work.
;Load the WinInet extender
AddExtender("WWINT34i.DLL")
origdir=DirGet()


;Define key values
;Get host name from ACTION= parameter or induce it from Web page viewed
host="patriotweb.gmu.edu:9977"
;Get mainurl also from action line
mainurl="/pls/prod/bwckgens.p_sel_term_date"

;https://patriotweb.gmu.edu:9977/pls/prod/bwckschd.p_disp_detail_sched?term_in=200470&crn_in=72948

;Define output file name
outfile=strcat(origdir,"result3.html")


;Format form data. First define the formdata variable as a null string
formdata=""
;Then add the required form fields one value=pair at a time.
formdata=iContentUrl(formdata,"call_proc_in", "bwckschd.p_crse_search_unsec")
formdata=iContentUrl(formdata,"term_in","200470")
formdata=iContentUrl(formdata,"from_id","")
formdata=iContentUrl(formdata,"to_id","")
formdata=iContentUrl(formdata,"submit", "Submit")


; Basic web page fetch script
tophandle=iBegin(1,"129.0.0.111","")
;iOptionSet(tophandle,"user_agent","Mozilla compatible WinBatch")
connecthandle=iHostConnect(tophandle, host, @HTTPS, "", "")
datahandle=iHttpInit(connecthandle,"POST",mainurl,"", 0)


rslt = iHttpOpen(datahandle, 0, formdata, -1);


If rslt == "ERROR" || rslt != 200
Message(StrCat("Error ",iGetLastError()),iGetResponse())
headers=iHttpHeaders(datahandle)
AskItemList("Rslt=%rslt%",headers,@tab,@unsorted,@single)
endif
xx=iReadData(datahandle,outfile)
iClose(datahandle)
iClose(connecthandle)
iClose(tophandle)


;Message("FileRead",strcat(testfile1,@crlf,"backed up to",@crlf,testfile2))

;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.
ShellExecute(outfile,"","",@NORMAL,"OPEN")

exit 

Answer:

Well the mainurl variable is not set to the same url sown in the https comment below.... Maybe you need some headers? Or even a packet sniffer.

User Reply:

How do I find the headers I need? I double checked and the url is the correct on from the FORM ACTION. Where do I get a packet sniffer and will it work with HTTPS?

Answer:

Headers? You can see what they are by hitting a dumpinput server like ours. Then pick in choose what you think might be applicable. I would read up in the "Finicky" example in the help file.

Ahhh a packet sniffer that can make sense of http transmissions. Indeed a rare beast. I have heard tell of one that cheats my hooking into MSIE so you can see what is being transmitted. A quick google seatch on 'packet sniffer http' turns up: http://www.httpwatch.com/moreinfo.htm and http://www.httpsniffer.com/

both which look somewhat promising.


Article ID:   W16376
File Created: 2005:02:18:12:20:06
Last Updated: 2005:02:18:12:20:06