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.

ERROR returned from iOptionGet

Keywords:   iOptionGet

Question:

I tried to use the "iOptionGet" -> "url" but it returns an "ERROR". This feature did not seem to work on regular pages for me. I notice it returned an error when i tried it on the www.amazon.com example for Inet as well. How can I capture that key ??
AddExtender("WWINT34i.DLL")
 
origdir=DirGet()
 
 
;Key values
host = "fsecure.royalbank.com" ; from source
;FORM action
mainurl="/RBC/IFTLogin.asp"
 
outfile=strcat(origdir, "main1.html")

formdata="" ;initialize
;required data passed fields
formdata=iContentUrl(formdata, "UserId", "********")
formdata=iContentUrl(formdata, "Password", "********")
formdata=iContentUrl(formdata, "LoginButton", "Login")

; Basic Web page fetch Script
tophandle=iBegin(2, ""," ")
connecthandle=iHostConnect(tophandle, host, @HTTPS, "", "")
datahandle=ihttpInit(connecthandle, "POST", mainurl, "", 0)  ;watch referer for security reasons
rslt = iHttpOpen(datahandle, "", formdata, -1);
If rslt == "ERROR" || rslt != 200
	Message( StrCat("Error: ", iGetlastError() ), iGetResponse() )
	headers=iHttpHeaders(datahandle)
	AskItemList("Rslt=%rslt%",headers, @tab, @unsorted, @single)
Endif

Message("tophandle", tophandle)
Message("rslt", rslt)
Message("Headers", iHttpHeaders(datahandle))
Message("Connect Handle", connecthandle)
Message("datahandle", datahandle)
urlcapture = iOptionGet(tophandle, "url")  ;<== ERRORS out
Message("URL", "%urlcapture%")
xx=iReadData(datahandle, outfile)

;now have the returned web
; use the web browser to execute it
ShellExecute(outfile, "", "", @NORMAL, "OPEN")

;Run(strcat(origdir, "amazonpost3.wbt"),"")

Answer:

There was an error in the documentation for WinInet.
iOptionGet(datahandle, "url") ->documentation says iOptionGet(tophandle,"url")
e.g.,
  
 -----------------------------------------------
 :CONNECTION1URL
 xx = iOptionGet(datahandle,"url") ;gets the url of CONNECTION1=MainPage=main1.html
 urlcapture = iOptionGet(datahandle, "url")
 IniWritePVT("URLS", "mainpurl", urlcapture, wbINI);saves the url to ini file
 

Article ID:   W15094
File Created: 2017:07:28:13:58:45
Last Updated: 2002:09:05:13:49:31