Sample code for 30+ languages & platforms
Visual FoxPro

Transition from Http.PBinaryBd to Http.HttpBd

Provides instructions for replacing deprecated PBinaryBd method calls with HttpBd.

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loHttp
LOCAL lcVerb
LOCAL lcUrl
LOCAL loBdRequestBody
LOCAL lcContentType
LOCAL loResponseObj
LOCAL loResponseOut

lnSuccess = 0

loHttp = CreateObject('Chilkat.Http')

lcVerb = "POST"
lcUrl = "https://example.com/"
loBdRequestBody = CreateObject('Chilkat.BinData')
lcContentType = "application/octet-stream"

* ------------------------------------------------------------------------
* The PBinaryBd method is deprecated:

loResponseObj = loHttp.PBinaryBd(lcVerb,lcUrl,loBdRequestBody,lcContentType,0,0)
IF (loHttp.LastMethodSuccess = 0) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    RELEASE loBdRequestBody
    CANCEL
ENDIF

* ...
* ...

RELEASE loResponseObj

* ------------------------------------------------------------------------
* Do the equivalent using HttpBd.
* 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.HttpBd(lcVerb,lcUrl,loBdRequestBody,lcContentType,loResponseOut)
IF (lnSuccess = 0) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    RELEASE loBdRequestBody
    RELEASE loResponseOut
    CANCEL
ENDIF

RELEASE loHttp
RELEASE loBdRequestBody
RELEASE loResponseOut