I'm writting a monitor program to see if our web server is ready to accept request by trying to resolve a URL of a known page. If the page is not found, then my program would send messages. Trying to use HTTPOpen() and never receive the 404 that I expected. Here is the test script.
tophandle=iBegin(0,"","")
connecthandle=iHostConnect(tophandle, ThisHost,@HTTP,"", "")
datahandle=iHttpInit(connecthandle, "GET", Object, "",0)
If datahandle==0
err=iGetLastError()
Message("Last Error",err)
iClose(tophandle)
Exit
EndIf
myheader=StrCat("user_process: My cool app", @CRLF, "app_version: 12.0")
rslt=iHttpOpen(datahandle, "" , 0, 0)
Message("HTTPGet", "Response Code = %rslt%")
If rslt=="ERROR" || rslt!=200
If rslt == "ERROR"
errstr = "WinInet Error"
rslt = iGetLastError()
Else
errstr = "HTTP Error"
EndIf
Message(errstr,rslt)
iClose(tophandle)
Exit
EndIf
xx=iReadData(datahandle, StrCat(ProgramPath, "HTTPGet.txt"))
iClose(datahandle)
iClose(connecthandle)
iClose(tophandle)
Message("All","Done")
Exit
Is there a better way to do this?