public void getResponse(StringBuilder sb) throws IOException {

        // checks server's status code first
        int status = mHttpURLConnection.getResponseCode();
        if (status == HttpURLConnection.HTTP_OK) {
            InputStream ips = new BufferedInputStream(mHttpURLConnection.getInputStream());
            BufferedReader reader = new BufferedReader(new InputStreamReader(ips, "UTF-8"));

            char[] buffer = new char[1024];
            int bufferLength;
            while ((bufferLength = reader.read(buffer, 0, buffer.length)) > 0) {
                sb.append(buffer, 0, bufferLength);
            }
            reader.close();
            ips.close();
            mHttpURLConnection.disconnect();
        } else {
            throw new IOException("Server returned non-OK status: " + status);
        }
    }
public void getResponse(StringBuilder sb) throws IOException {

        
        int status = mHttpURLConnection.getResponseCode();
        if (status == HttpURLConnection.HTTP_OK) {
            InputStream ips = new BufferedInputStream(mHttpURLConnection.getInputStream());
            BufferedReader reader = new BufferedReader(new InputStreamReader(ips, "UTF-8"));

            char[] buffer = new char[1024];
            int bufferLength;
            while ((bufferLength = reader.read(buffer, 0, buffer.length)) > 0) {
                sb.append(buffer, 0, bufferLength);
            }
            reader.close();
            ips.close();
            mHttpURLConnection.disconnect();
        } else {
            throw new IOException("Server returned non-OK status: " + status);
        }
    }
public void getResponse ( StringBuilder sb ) throws IOException { // checks server's status code first int status = mHttpURLConnection . getResponseCode ( ) ; if ( status == HttpURLConnection . HTTP_OK ) { InputStream ips = new BufferedInputStream ( mHttpURLConnection . getInputStream ( ) ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( ips , "UTF-8" ) ) ; char [ ] buffer = new char [ 1024 ] ; int bufferLength ; while ( ( bufferLength = reader . read ( buffer , 0 , buffer . length ) ) > 0 ) { sb . append ( buffer , 0 , bufferLength ) ; } reader . close ( ) ; ips . close ( ) ; mHttpURLConnection . disconnect ( ) ; } else { throw new IOException ( "Server returned non-OK status: " + status ) ; } }
Completes the request and receives response from the server.

@return a list of Strings as response in case the server returned
status OK, otherwise an exception is thrown.
@throws IOException
Completes the request and receives response from the server .