Visual FoxPro
Visual FoxPro
POST application/json HTTPS Request
See more HTTP Examples
Demonstrates how to send an HTTPS POST where the request body and response body both have the application/json Content-Type. Also demonstrates how to add a few custom headers to the request.Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loHttp
LOCAL lcUrl
LOCAL lcJsonRequestBody
LOCAL loResp
LOCAL lcJsonResponseStr
lnSuccess = 0
* This requires the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code
loHttp = CreateObject('Chilkat.Http')
* Add a few custom headers.
loHttp.SetRequestHeader("Client-ID","my_client_id")
loHttp.SetRequestHeader("Client-Token","my_client_token")
loHttp.Accept = "application/json"
lcUrl = "https://api.fiscallog.eu/sign/v1"
lcJsonRequestBody = "{ .... }"
loResp = CreateObject('Chilkat.HttpResponse')
lnSuccess = loHttp.HttpStr("POST",lcUrl,lcJsonRequestBody,"utf-8","application/json",loResp)
IF (lnSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
RELEASE loResp
CANCEL
ENDIF
? "Response status code = " + STR(loResp.StatusCode)
lcJsonResponseStr = loResp.BodyStr
? lcJsonResponseStr
RELEASE loHttp
RELEASE loResp