我想要这样的东西。当用户输入用户名和密码然后单击登录按钮时,我有一个按钮和 2 个文本框,然后将执行登录操作,然后欢迎用户并转到另一个页面。我的代码是这样的:
try {
Connection.Response res = Jsoup.connect("URL")
.data("log", "abcd", "pwd", "12345", "wp-submit", "প্রবেশ", "redirect_to", "url", "testcookie", "1")
.method(Method.POST)
.execute();
Map<String, String> cookies = res.cookies();
Document doc2 = Jsoup
.connect("new_url")
.cookies(cookies)
.get();
s = doc2.text().toString();
t.setText(s);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
t.setText("no");
}
但是登录操作不能成功,这里总是显示“否”。我怎样才能成功地做到这一点???