1
我嘗試登錄本網站使用Jsoup上:https://www.startus.cc/Jsoup認證
我用下面的代碼是:
String url = "https://www.startus.cc/user/login";
String userAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36";
Connection.Response response = Jsoup.connect(url).userAgent(userAgent)
.method(Connection.Method.GET)
.execute();
response = Jsoup.connect(url)
.cookies(response.cookies())
.data("name", "myname")
.data("pass", "mypass")
.data("op", "Log in")
.userAgent(userAgent)
.method(Connection.Method.POST)
.followRedirects(true)
.execute();
Document doc = Jsoup.connect("https://www.startus.cc/")
.cookies(response.cookies())
.userAgent(userAgent)
.get();
System.out.println(doc);
它打印我頁面的HTML內容,但它仍未登錄。你知道這裏缺少什麼嗎?謝謝!
謝謝你的幫助!你能解釋一下更多的form_build_id參數嗎? –
似乎是表單狀態ID - 來源:https://drupal.stackexchange.com/a/203027 – r3dst0rm