Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static String receiveFromBackEnd(String url, String json) throws IOException, JSONException {
- StringBuilder str = new StringBuilder();
- HttpClient httpclient = new DefaultHttpClient();
- HttpPost httppost = new HttpPost(url);
- httppost.addHeader(new BasicHeader("Content-Type",
- "application/json"));
- httppost.setEntity(new StringEntity(json));
- HttpResponse response = httpclient.execute(httppost);
- BufferedReader reader = new BufferedReader(new InputStreamReader(
- response.getEntity().getContent()));
- String line;
- while ((line = reader.readLine()) != null) {
- str.append(line);
- }
- return str.toString();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement