![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(AutoIt) Transition from Http.PostUrlEncoded to Http.HttpReqProvides instructions for replacing deprecated PostUrlEncoded method calls with HttpReq. Sends the following raw HTTP request: POST /echoPost.asp HTTP/1.1 Host: www.chilkatsoft.com Content-Type: application/x-www-form-urlencoded Content-Length: 50 company=example&ip=111.111.111.111&url=example.com Note: This example requires Chilkat v11.0.0 or greater.
Local $bSuccess = False $oHttp = ObjCreate("Chilkat.Http") Local $sUrl = "https://www.chilkatsoft.com/echoPost.asp" $oReq = ObjCreate("Chilkat.HttpRequest") $oReq.AddParam "company","example" $oReq.AddParam "ip","111.111.111.111" $oReq.AddParam "url","example.com" ; ------------------------------------------------------------------------ ; The PostUrlEncoded method is deprecated: Local $oResponseObj = $oHttp.PostUrlEncoded($sUrl,$oReq) If ($oHttp.LastMethodSuccess = False) Then ConsoleWrite($oHttp.LastErrorText & @CRLF) Exit EndIf ; ... ; ... ; ------------------------------------------------------------------------ ; Do the equivalent using HttpReq. ; Your application creates a new, empty HttpResponse object which is passed ; in the last argument and filled upon success. $oReq2 = ObjCreate("Chilkat.HttpRequest") $oReq2.AddParam "company","example" $oReq2.AddParam "ip","111.111.111.111" $oReq2.AddParam "url","example.com" $oReq2.HttpVerb = "POST" $oReq2.ContentType = "application/x-www-form-urlencoded" $oResp = ObjCreate("Chilkat.HttpResponse") $bSuccess = $oHttp.HttpReq($sUrl,$oReq2,$oResp) If ($bSuccess = False) Then ConsoleWrite($oHttp.LastErrorText & @CRLF) Exit EndIf ; Results are contained in the HTTP response object... |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.