
βοΈHTTP Client
Get data from server the easy way.
KHTTPClient Class Overview
Example GET Request
KHTTPClient http = new KHTTPClient();
if (!http.get("https://reqbin.com/echo/get/json")) {
KLog.error("Error: {}", http.getLastError());
} else {
System.out.println(http.getResponseDataAsString());
}Example POST Request with Basic Authentication
Properties props = new Properties();
props.put("Authorization", "Basic " + K.encodeBase64(userName + ':' + password);
KHTTPClient http = new KHTTPClient();
if (!http.post("https://example.com:4443", props, "HTTP body data")) {
KLog.abort("HTTP POST failed - " + http.getLastError());
}Last updated