我登录到该网站(我知道,因为代码的结果显示我在:“Dilema Veche Contul meu Logout Întreb?ri frecvente ...等)但我无法浏览登录网站的链接,好像没有保留cookies什么的。有什么建议吗?谢谢。
公共类艺术 { 公共静态无效主(最终字符串 [] args)抛出 IOException {
Response res = Jsoup.connect("http://pay.dilemaveche.ro/autentificare/?redirect=http%3A%2F%2Fdilemaveche.ro%2F%2F&return=true").data("username", "myusername", "password", "mypassword").method(Method.POST).execute();
Map <String, String> cookies = res.cookies();
Document doc = Jsoup.connect("http://pay.dilemaveche.ro/autentificare/?redirect=http%3A%2F%2Fdilemaveche.ro%2F%2F&return=true").cookies(cookies).get();
Elements bck = doc.select("li.first").select("a[href]:contains(Dilema Veche)");
String str = bck.attr("abs:href");
Document doc0 = Jsoup.connect(str).cookies(cookies).get();
System.out.println(doc.text());
}
}