PureBasic
PureBasic
POST XML to https://apicert.sii.cl/recursos/v1/boleta.electronica.token
See more HTTP Misc Examples
Demonstrates how to send an HTTPS POST XML request to POST XML to https://apicert.sii.cl/recursos/v1/boleta.electronica.token and retrieve the response.Chilkat PureBasic Downloads
IncludeFile "CkHttpResponse.pb"
IncludeFile "CkHttp.pb"
Procedure ChilkatExample()
success.i = 0
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
http.i = CkHttp::ckCreate()
If http.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
; XML to send in the body of the HTTPS POST
xmlStr.s = "..."
urlEndpoint.s = "https://apicert.sii.cl/recursos/v1/boleta.electronica.token"
xmlCharset.s = "utf-8"
resp.i = CkHttpResponse::ckCreate()
If resp.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success = CkHttp::ckHttpStr(http,"POST",urlEndpoint,xmlStr,"utf-8","application/xml",resp)
If success = 0
Debug CkHttp::ckLastErrorText(http)
CkHttp::ckDispose(http)
CkHttpResponse::ckDispose(resp)
ProcedureReturn
EndIf
; Get the response status code and body
Debug "response status code = " + Str(CkHttpResponse::ckStatusCode(resp))
; This would be the XML response sent by the server.
Debug CkHttpResponse::ckBodyStr(resp)
CkHttp::ckDispose(http)
CkHttpResponse::ckDispose(resp)
ProcedureReturn
EndProcedure