(Visual FoxPro) Send HTTPS POST with XML Body
Demonstrates how to send an HTTP (or HTTPS) POST where the body of the request is XML. Note: This example requires Chilkat v11.0.0 or greater.
LOCAL lnSuccess
LOCAL loHttp
LOCAL lcStrXml
LOCAL loResp
lnSuccess = 0
* This example requires the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
loHttp = CreateObject('Chilkat.Http')
lcStrXml = '<TransactionSetup xmlns="https://xyz.com"><Credentials><AccountID>XXX</AccountID></Credentials></TransactionSetup>'
* Maybe you need other headers?
loHttp.SetRequestHeader("Accept","application/xml")
loResp = CreateObject('Chilkat.HttpResponse')
lnSuccess = loHttp.HttpStr("POST","https://www.somewebsite.com/",lcStrXml,"utf-8","application/xml",loResp)
IF (lnSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
RELEASE loResp
CANCEL
ENDIF
* Examine the response status code:
? "response status code = " + STR(loResp.StatusCode)
* Examine the response body:
? "response body: " + loResp.BodyStr
RELEASE loHttp
RELEASE loResp
|