Skip to content

Instantly share code, notes, and snippets.

@javawolfpack
Created April 10, 2015 02:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save javawolfpack/9874d5e9a79b614f47b7 to your computer and use it in GitHub Desktop.
Save javawolfpack/9874d5e9a79b614f47b7 to your computer and use it in GitHub Desktop.
HTTP Post Example
HttpPost httpost = new HttpPost("<Server address here>");
StringEntity se = new StringEntity(JSONObject.toString());
httpost.setEntity(se);
httpost.setHeader("Accept", "application/json");
httpost.setHeader("Content-type", "application/json");
ResponseHandler responseHandler = new BasicResponseHandler();
String responseBody = httpclient.execute(httpost, responseHandler);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment