![]() |
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
(PureBasic) Transition from Http.PostJson to Http.HttpStrProvides instructions for replacing deprecated PostJson method calls with HttpStr. Note: This example requires Chilkat v11.0.0 or greater.
IncludeFile "CkHttpResponse.pb" IncludeFile "CkHttp.pb" Procedure ChilkatExample() http.i = CkHttp::ckCreate() If http.i = 0 Debug "Failed to create object." ProcedureReturn EndIf url.s = "https://example.com/something" jsonText.s = "{ ... }" ; ------------------------------------------------------------------------ ; The PostJson method is deprecated: responseObj.i = CkHttp::ckPostJson(http,url,jsonText) If CkHttp::ckLastMethodSuccess(http) = 0 Debug CkHttp::ckLastErrorText(http) CkHttp::ckDispose(http) ProcedureReturn EndIf ; ... ; ... CkHttpResponse::ckDispose(responseObj) ; ------------------------------------------------------------------------ ; Do the equivalent using HttpStr. ; Your application creates a new, empty HttpResponse object which is passed ; in the last argument and filled upon success. responseOut.i = CkHttpResponse::ckCreate() If responseOut.i = 0 Debug "Failed to create object." ProcedureReturn EndIf success.i = CkHttp::ckHttpStr(http,"POST",url,jsonText,"utf-8","application/json",responseOut) If success = 0 Debug CkHttp::ckLastErrorText(http) CkHttp::ckDispose(http) CkHttpResponse::ckDispose(responseOut) ProcedureReturn EndIf CkHttp::ckDispose(http) CkHttpResponse::ckDispose(responseOut) ProcedureReturn EndProcedure |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.