Skip to content

Instantly share code, notes, and snippets.

@fernandohs1500
Created December 11, 2019 21:36
Show Gist options
  • Save fernandohs1500/cfa804f57750e46bb9d639fcc5975944 to your computer and use it in GitHub Desktop.
Save fernandohs1500/cfa804f57750e46bb9d639fcc5975944 to your computer and use it in GitHub Desktop.
HTTP CLIENT REQUEST JAVA
jsonParams.put("wallet", billetRequest.getWallet());
JSONObject jsonParams = new JSONObject();
jsonParams.put("user", user);
StringEntity params = new StringEntity(jsonParams.toString());
HttpPost post = new HttpPost(url);
post.addHeader("Authorization", autorizathion);
post.addHeader("Content-Type", "application/json");
post.setEntity(params);
CloseableHttpClient httpClient = HttpClients.createDefault();
CloseableHttpResponse response = httpClient.execute(post);
String result = EntityUtils.toString(response.getEntity());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment