AutoIt
AutoIt
Transition from Http.PostUrlEncoded to Http.HttpReq
Provides 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
Chilkat AutoIt Downloads
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...