![]() |
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
(Java) Example: Http.QuickGetStr methodDemonstrates the
import com.chilkatsoft.*; public class ChilkatExample { static { try { System.loadLibrary("chilkat"); } catch (UnsatisfiedLinkError e) { System.err.println("Native code library failed to load.\n" + e); System.exit(1); } } public static void main(String argv[]) { CkHttp http = new CkHttp(); // Keep the response body if there's an error. http.put_KeepResponseBody(true); // Send the HTTP GET and return the content in a string. String str = http.quickGetStr("https://www.chilkatsoft.com/helloWorld.json"); if (http.get_LastMethodSuccess() == false) { if (http.get_LastStatus() == 0) { // Communications error. We did not get a response. System.out.println(http.lastErrorText()); } else { System.out.println("Response status code: " + http.get_LastStatus()); System.out.println("Response body error text:"); System.out.println(http.lastResponseBody()); } return; } System.out.println(str); System.out.println("Success"); } } |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.