How to get Content on Post Method

I've used below code for HttpPost, Its execute successfully. But unable to see the response.I get InputStream. I want to know what are the contents in it.

I want to display as string format.How to do this.

        HttpPost httppost = new HttpPost(requestURL);
        ArrayList<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(params.length);

        for (int postValueCount = 0; postValueCount < params.length; postValueCount++)
            nameValuePairs.add(new BasicNameValuePair(params[postValueCount][0],params[postValueCount][1]));

        try {
            httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
            Log.d("HttpPostRequest","URL : " + httppost.getRequestLine().getUri());
            Log.d("HttpPostRequest","Method : " + httppost.getRequestLine().getMethod());
            Log.d("HttpPostRequest","Parameters : " + nameValuePairs);
            response = httpclient.execute(httppost);
            status = response.getStatusLine();

            if (status.getReasonPhrase().equals("OK")) {
                InputStream in = httpEntity.getContent();               
                return in;
            } else {
                Log.d("Http Status", status.getReasonPhrase());



Use this code:

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

Here is what i have used in a project of mine.

static String isToString(InputStream is) {
    StringBuilder sb = null;
    String result = null;
    try {
        BufferedReader reader = new BufferedReader(new InputStreamReader(
                is, "iso-8859-1"), 8);
        sb = new StringBuilder();
        sb.append(reader.readLine() + "\n");
        String line = "0";

        while ((line = reader.readLine()) != null) {
            sb.append(line + "\n");

        result = sb.toString();

    } catch (Exception e) {
        System.err.println("Error converting result " + e.toString());
        return null;

    return result;

Need Your Help

Using box-api in an ARC project?

ios automatic-ref-counting box-api

How can I use the box-api in a project using ARC?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.