Answer the question
In order to leave comments, you need to log in
How to send POST json data to body via WebView?
Welcome all!
Android.
There was a task to send POST request through WebView. The request must contain json in the body.
How can this be implemented?
google did not help (I only found sending data in the parameters, but I need it in the body).
Or can you suggest an alternative?
Answer the question
In order to leave comments, you need to log in
Those. like this:
HttpPost httpost = new HttpPost("http://...");
httpost.setEntity(new StringEntity("{\"param_name\":\"param\"}"));
httpost.setHeader("Accept", "application/json");
httpost.setHeader("Content-type", "application/json; charset=UTF-8");
HttpResponse response = httpClient.execute(httpPost);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question