Sample code for 30+ languages & platforms
Xbase++ Requires Chilkat v11.0.0+

Transition from Http.SynchronousRequest to Http.HttpSReq

Provides instructions for replacing deprecated SynchronousRequest method calls with HttpSReq.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oHttp
LOCAL cDomain
LOCAL nPort
LOCAL nTls
LOCAL oReq
LOCAL oResponseObj
LOCAL oResponseOut

nSuccess := 0

oHttp := CreateObject("Chilkat.Http")

cDomain := "example.com"
nPort := 443
nTls := 1

oReq := CreateObject("Chilkat.HttpRequest")
oReq:HttpVerb := "POST"
oReq:Path := "/some/path"
oReq:ContentType := "application/x-www-form-urlencoded"
oReq:AddParam("firstName", "Matt")
oReq:AddParam("lastName", "Smith")

//  ------------------------------------------------------------------------
//  The SynchronousRequest method is deprecated:

oResponseObj := oHttp:SynchronousRequest(cDomain, nPort, nTls, oReq)
IF (oHttp:LastMethodSuccess == 0)
    ? oHttp:LastErrorText
    oHttp:destroy()
    oReq:destroy()
    RETURN
ENDIF

//  ...
//  ...

oResponseObj:destroy()

//  ------------------------------------------------------------------------
//  Do the equivalent using HttpSReq.
//  Your application creates a new, empty HttpResponse object which is passed 
//  in the last argument and filled upon success.

oResponseOut := CreateObject("Chilkat.HttpResponse")
nSuccess := oHttp:HttpSReq(cDomain, nPort, nTls, oReq, oResponseOut)
IF (nSuccess == 0)
    ? oHttp:LastErrorText
    oHttp:destroy()
    oReq:destroy()
    oResponseOut:destroy()
    RETURN
ENDIF

oHttp:destroy()
oReq:destroy()
oResponseOut:destroy()