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) POST application/x-www-form-urlencoded using REST APIDemonstrates how to send a POST with query params (x-www-form-urlencoded) using the Chilkat REST object.
; This example requires the Chilkat API to have been previously unlocked. ; See Global Unlock Sample for sample code. $oRest = ObjCreate("Chilkat.Rest") ; This example will send to https://www.chilkatsoft.com/echoPost.asp ; Make the initial connection (without sending a request yet). Local $bTls = True Local $iPort = 443 Local $bAutoReconnect = True Local $bSuccess = $oRest.Connect("www.chilkatsoft.com",$iPort,$bTls,$bAutoReconnect) If ($bSuccess <> True) Then ConsoleWrite($oRest.LastErrorText & @CRLF) Exit EndIf ; Provide query params. $oRest.AddQueryParam("firstName","John") $oRest.AddQueryParam("lastName","Doe") $oRest.AddQueryParam("company","Bisco Bits Ltd.") Local $sResponseStr = $oRest.FullRequestFormUrlEncoded("POST","/echoPost.asp") If ($oRest.LastMethodSuccess <> True) Then ConsoleWrite($oRest.LastErrorText & @CRLF) Exit EndIf ; When successful, the response status code will equal 200. If ($oRest.ResponseStatusCode <> 200) Then ; Examine the request/response to see what happened. ConsoleWrite("response status code = " & $oRest.ResponseStatusCode & @CRLF) ConsoleWrite("response status text = " & $oRest.ResponseStatusText & @CRLF) ConsoleWrite("response header: " & $oRest.ResponseHeader & @CRLF) ConsoleWrite("response body (if any): " & $sResponseStr & @CRLF) ConsoleWrite("---" & @CRLF) ConsoleWrite("LastRequestStartLine: " & $oRest.LastRequestStartLine & @CRLF) ConsoleWrite("LastRequestHeader: " & $oRest.LastRequestHeader & @CRLF) Exit EndIf ConsoleWrite($sResponseStr & @CRLF) ConsoleWrite("Success." & @CRLF) |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.