AutoIt
AutoIt
Transition from Http.PostJson2 to Http.HttpStr
Provides instructions for replacing deprecated PostJson2 method calls with HttpStr.Chilkat AutoIt Downloads
Local $bSuccess = False
$oHttp = ObjCreate("Chilkat.Http")
Local $sUrl = "https://example.com/something"
Local $sContentType = "application/json"
Local $sJsonText = "{ ... }"
; ------------------------------------------------------------------------
; The PostJson2 method is deprecated:
Local $oResponseObj = $oHttp.PostJson2($sUrl,$sContentType,$sJsonText)
If ($oHttp.LastMethodSuccess = False) Then
ConsoleWrite($oHttp.LastErrorText & @CRLF)
Exit
EndIf
; ...
; ...
; ------------------------------------------------------------------------
; Do the equivalent using HttpStr.
; Your application creates a new, empty HttpResponse object which is passed
; in the last argument and filled upon success.
$oResponseOut = ObjCreate("Chilkat.HttpResponse")
$bSuccess = $oHttp.HttpStr("POST",$sUrl,$sJsonText,"utf-8",$sContentType,$oResponseOut)
If ($bSuccess = False) Then
ConsoleWrite($oHttp.LastErrorText & @CRLF)
Exit
EndIf