Поддержите, я хочу войти здесь: http://www.vodafone.it/190/trilogy/jsp/home.do, и я использую код:
HttpGet httpget = new HttpGet("http://www.vodafone.it/190/trilogy/jsp/home.do");
HttpResponse response = httpclient.execute(httpget);
HttpEntity entity = response.getEntity();
System.out.println("Initial set of cookies:");
List<Cookie> cookies = httpclient.getCookieStore().getCookies();
if (cookies.isEmpty()) {
System.out.println("None");
} else {
for (int i = 0; i < cookies.size(); i++) {
System.out.println("- " + cookies.get(i).toString());
}
}
//Visito la pagina del Login
HttpPost httpost = new HttpPost("https://www.vodafone.it/190/trilogy/jsp/login.do");
List<NameValuePair> nvps = new ArrayList<NameValuePair>();
nvps.add(new BasicNameValuePair("username", ""));
nvps.add(new BasicNameValuePair("password", ""));
httpost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
response = httpclient.execute(httpost);
entity = response.getEntity();
System.out.println("Post logon cookies:");
cookies = httpclient.getCookieStore().getCookies();
if (cookies.isEmpty()) {
System.out.println("None");
} else {
for (int i = 0; i < cookies.size(); i++) {
System.out.println("- " + cookies.get(i).toString());
}
}
Если это правильно, как я могу узнать, вошел ли я в систему?