Visual FoxPro
Visual FoxPro
Transition from Http.SynchronousRequest to Http.HttpSReq
Provides instructions for replacing deprecated SynchronousRequest method calls with HttpSReq.Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loHttp
LOCAL lcDomain
LOCAL lnPort
LOCAL lnTls
LOCAL loReq
LOCAL loResponseObj
LOCAL loResponseOut
lnSuccess = 0
loHttp = CreateObject('Chilkat.Http')
lcDomain = "example.com"
lnPort = 443
lnTls = 1
loReq = CreateObject('Chilkat.HttpRequest')
loReq.HttpVerb = "POST"
loReq.Path = "/some/path"
loReq.ContentType = "application/x-www-form-urlencoded"
loReq.AddParam("firstName","Matt")
loReq.AddParam("lastName","Smith")
* ------------------------------------------------------------------------
* The SynchronousRequest method is deprecated:
loResponseObj = loHttp.SynchronousRequest(lcDomain,lnPort,lnTls,loReq)
IF (loHttp.LastMethodSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
RELEASE loReq
CANCEL
ENDIF
* ...
* ...
RELEASE loResponseObj
* ------------------------------------------------------------------------
* Do the equivalent using HttpSReq.
* Your application creates a new, empty HttpResponse object which is passed
* in the last argument and filled upon success.
loResponseOut = CreateObject('Chilkat.HttpResponse')
lnSuccess = loHttp.HttpSReq(lcDomain,lnPort,lnTls,loReq,loResponseOut)
IF (lnSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
RELEASE loReq
RELEASE loResponseOut
CANCEL
ENDIF
RELEASE loHttp
RELEASE loReq
RELEASE loResponseOut