Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(AutoIt) TicketBAI -- Send HTTP POSTSee more TicketBAI ExamplesDemonstrates how to send a TicketBAI POST and get the response.
; This example requires the Chilkat API to have been previously unlocked. ; See Global Unlock Sample for sample code. $oHttp = ObjCreate("Chilkat.Http") Local $bSuccess = $oHttp.SetSslClientCertPfx("your.pfx","pfx_password") If ($bSuccess = False) Then ConsoleWrite($oHttp.LastErrorText & @CRLF) Exit EndIf ; Get the XML we wish to send in the body of the request. $oSbXml = ObjCreate("Chilkat.StringBuilder") $bSuccess = $oSbXml.LoadFile("qa_data/payload.xml","utf-8") If ($bSuccess = False) Then ConsoleWrite("Failed to load XML that is to be the HTTP request body" & @CRLF) Exit EndIf ; Build the following JSON ; { ; "con": "LROE", ; "apa": "1.1", ; "inte": { ; "nif": "número de identificación fiscal", ; "nrs": "nombre o Razón social", ; "ap1": "primer apellido", ; "ap2": "segundo apellido" ; }, ; "drs": { ; "mode": "140", ; "ejer": "ejercicio" ; } ; } ; Use this online tool to generate code from sample JSON: ; Generate Code to Create JSON $oJson = ObjCreate("Chilkat.JsonObject") $oJson.UpdateString("con","LROE") $oJson.UpdateString("apa","1.1") $oJson.UpdateString("inte.nif","número de identificación fiscal") $oJson.UpdateString("inte.nrs","nombre o Razón social") $oJson.UpdateString("inte.ap1","primer apellido") $oJson.UpdateString("inte.ap2","segundo apellido") $oJson.UpdateString("drs.mode","140") $oJson.UpdateString("drs.ejer","ejercicio") ; Add required headers... $oHttp.SetRequestHeader "eus-bizkaia-n3-version","1.0" $oHttp.SetRequestHeader "eus-bizkaia-n3-content-type","application/xml" $oHttp.SetRequestHeader "eus-bizkaia-n3-data",$oJson.Emit() Local $sUrl = "https://pruesarrerak.bizkaia.eus/N3B4000M/aurkezpena" Local $bGzip = True Local $oResp = $oHttp.PTextSb("POST",$sUrl,$oSbXml,"utf-8","application/octet-stream",False,$bGzip) If ($oHttp.LastMethodSuccess = False) Then ConsoleWrite($oHttp.LastErrorText & @CRLF) Exit EndIf $oHttp.ClearHeaders ConsoleWrite("response status code: " & $oResp.StatusCode & @CRLF) ; Examine the response (it is already decompressed) ConsoleWrite("response body:" & @CRLF) ConsoleWrite($oResp.BodyStr & @CRLF) |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.