Sample code for 30+ languages & platforms
Lianja

Transition from Http.SynchronousRequest to Http.HttpSReq

Provides instructions for replacing deprecated SynchronousRequest method calls with HttpSReq.

Chilkat Lianja Downloads

Lianja
llSuccess = .F.

loHttp = createobject("CkHttp")

lcDomain = "example.com"
lnPort = 443
lnTls = .T.

loReq = createobject("CkHttpRequest")
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 = .F.) then
    ? loHttp.LastErrorText
    release loHttp
    release loReq
    return
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("CkHttpResponse")
llSuccess = loHttp.HttpSReq(lcDomain,lnPort,lnTls,loReq,loResponseOut)
if (llSuccess = .F.) then
    ? loHttp.LastErrorText
    release loHttp
    release loReq
    release loResponseOut
    return
endif



release loHttp
release loReq
release loResponseOut