Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting "Couldn't read CGI input from STDIN" while processing Post request using HTTPClient in android
    text
    copied!<p>I am currently developing an android application, to submit a post request and to handle the corresponding response.</p> <p>I am able to hit the post request to the corresponding URL, But when I am trying to retrive the response, I am getting half of the HTML content followed by "<strong>*Couldn't read CGI input from STDIN.AFTER ALLOC_READ 0*</strong>"</p> <p>Could anyone please help me to solve this issue.</p> <p>Here are the code snippets</p> <pre><code>private void processRequest(String... params){ HttpPost post = new HttpPost("http://www.xyz.com"); HttpParams httpParams = post.getParams(); pnr = params[i]; httpParams.setParameter("param1", params[i]); //User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20100101 Firefox/14.0.1 httpParams.setParameter(CoreProtocolPNames.USER_AGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:14.0) Gecko/20100101 Firefox/14.0.1"); post.setParams(httpParams); HttpClient client = new DefaultHttpClient(); try { HttpResponse response = client.execute(post); HttpEntity entity = response.getEntity(); try { processHtmlString(pnr, inputStreamToString(entity.getContent()).toString()); } catch (IllegalStateException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally{ client.getConnectionManager().shutdown(); } } private String processHtmlString(String pnr, String htmlString) throws Exception{ int index = 0; while(index &lt; htmlString.length()){ int endIndex = (index + 3000) &lt; (htmlString.length()) ? (index + 3000) : htmlString.length(); Log.i("HttpHelper1","HTML1 : "+htmlString.substring(index, endIndex)); index += 3000; } } </code></pre> <p>and the output is ...........Couldn't read CGI input from STDIN.AFTER ALLOC_READ 0</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload