Visual FoxPro
Visual FoxPro
Transition from Http.PostJson2 to Http.HttpStr
Provides instructions for replacing deprecated PostJson2 method calls with HttpStr.Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loHttp
LOCAL lcUrl
LOCAL lcContentType
LOCAL lcJsonText
LOCAL loResponseObj
LOCAL loResponseOut
lnSuccess = 0
loHttp = CreateObject('Chilkat.Http')
lcUrl = "https://example.com/something"
lcContentType = "application/json"
lcJsonText = "{ ... }"
* ------------------------------------------------------------------------
* The PostJson2 method is deprecated:
loResponseObj = loHttp.PostJson2(lcUrl,lcContentType,lcJsonText)
IF (loHttp.LastMethodSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
CANCEL
ENDIF
* ...
* ...
RELEASE loResponseObj
* ------------------------------------------------------------------------
* Do the equivalent using HttpStr.
* 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.HttpStr("POST",lcUrl,lcJsonText,"utf-8",lcContentType,loResponseOut)
IF (lnSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
RELEASE loResponseOut
CANCEL
ENDIF
RELEASE loHttp
RELEASE loResponseOut