Sample code for 30+ languages & platforms
Xbase++

HTTP POST JSON

See more HTTP Examples

Demonstrates how to send a JSON POST and get the JSON response.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oHttp
LOCAL cJsonText
LOCAL oResp

nSuccess := 0

//  This requires the Chilkat API to have been previously unlocked.
//  See Global Unlock Sample for sample code

oHttp := CreateObject("Chilkat.Http")

cJsonText := '{"user":"doctoravatar@penzance.com","forecast":7,"t":"vlIj","zip":94089}'

//  IMPORTANT: Make sure to change the URL, JSON text,
//  and other data items to your own values.  The URL used
//  in this example will not actually work.

oResp := CreateObject("Chilkat.HttpResponse")
nSuccess := oHttp:HttpStr("POST", "https://json.penzance.org/request", cJsonText, "utf-8", "application/json", oResp)
IF (nSuccess == 0)
    ? oHttp:LastErrorText
    oHttp:destroy()
    oResp:destroy()
    RETURN
ENDIF

//  Display the JSON response.
? oResp:BodyStr

oHttp:destroy()
oResp:destroy()