Я пытаюсь автоматически войти на веб-страницу. Я предполагаю, что я передаю надлежащие учетные данные.
entity.getContentLength() показывает 20, но ответ, который я вижу, плохо отформатирован. Это не HTML. Как мне поступить дальше. Ниже мой код.
String input_text = "https://www.abc.com";
HttpPost httpost = new HttpPost(input_text);
List <NameValuePair> nvps = new ArrayList <NameValuePair>();
nvps.add(new BasicNameValuePair("email", "[email protected]"));
nvps.add(new BasicNameValuePair("passsword", "ttyyeri"));
nvps.add(new BasicNameValuePair("publicLoginToken",""));
httpost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
HttpResponse response = httpclient.execute(httpost);
entity = response.getEntity();
if (entity != null) {
BufferedReader br = new BufferedReader(new InputStreamReader(entity.getContent()));
String readLine;
while(((readLine = br.readLine()) != null)) {
System.err.println("br :"+readLine);
}
System.out.println("Response content length: " + entity.getContentLength());
}
System.out.println("HTML Content :::"+entity.getContent().toString());
It is not an HTML
чем это.? - person RanRag   schedule 08.02.2012firefox's live http header
, чтобы увидеть, что на самом деле происходит, когда вы входите в систему вручную. - person RanRag   schedule 08.02.2012