How to use http post method to call php webservice in android?

后端 未结 4 1806
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-22 04:27

I\'m calling php webservice through http post method. I\'m sending the request in the proper way, but when responce comes, it is not giving me response.

That\'s what I h

4条回答
  •  时光说笑
    2021-01-22 05:17

    Let's say your org.apache.http.message.BasicHttpResponse@4057fb48 is called response.
    To retrieve the data from the HttpResponse, you need:

    HttpEntity entity = response.getEntity();
    final InputStream inputStream = entity.getContent();
    

    You handle this InputStream depending on what kind of data it contains.

    If you need the String value of the response entity:

    HttpEntity entity = response.getEntity();
    final String responseText = EntityUtils.toString(entity);
    

提交回复
热议问题