Hello!
I'm getting a problem making an HTTP POST in Android.
The problem occur when the code is reading the response, it cant obtain the complete web page code I want to retrieve.
I only retrieve a piece of the web.
Here is the code:
try {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(URL);
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("text", "06092010"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response;
response=httpclient.execute(httppost);
BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
String s = "";
String line = reader.readLine();
while(line != null){
s += line+"\n";
line = reader.readLine();
}
Log.d("Street", "Result: "+s);
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
Log.d("Street", e.toString());
} catch (IOException e) {
// TODO Auto-generated catch block
Log.d("Street", e.toString());
} catch (Exception e) {
Log.d("Street", e.toString());
}