I do a post with android and HttpClient on a page, but I need to know a way to get the cookies from that connection.
This is the code I use to make the post
public static void postData(Activity activity, String user, String password) {
// Create a new HttpClient and Post Header
HttpClient httpClient = new DefaultHttpClient();
HttpPost httppost = new HttpPost([URL]);
try {
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("Email", user));
nameValuePairs.add(new BasicNameValuePair("Senha", password));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpClient.execute(httppost);
System.out.println("response:" + response);
HttpEntity entity = response.getEntity();
String responseString = EntityUtils.toString(entity, "UTF-8");
System.out.println(responseString);
} catch (ClientProtocolException e) {
System.out.println("ClientProtocolException: " + e.getMessage());
} catch (IOException e) {
System.out.println("IOException: " + e.getMessage());
}
}