这就是我想要做的,但我不知道如何将登录按钮添加到 formData hashMap
private fun getData() {
Log.d(TAG, "getLoginPage: ")
try {
val loginFormResponse=Jsoup.connect(getString(R.string.loginUrl))
.method(Connection.Method.GET)
.userAgent("Mozilla")
.execute()
val document=loginFormResponse.parse()
val cookies: HashMap<String, String> = HashMap(loginFormResponse.cookies())
Log.d(TAG, "getData: ------------------------------${cookies["__RequestVerificationToken"]}")
val authToken:String=cookies["__RequestVerificationToken"]!!
val formData: HashMap<String, String> = HashMap()
formData["utf8"] = "e2 9c 93";
formData["Email"] ="teacher@gmail.com"
formData["Password"] ="tttt"
formData["__RequestVerificationToken"] = authToken
//Missing login button here
val homePage = Jsoup.connect(getString(R.string.loginUrl))
.cookies(cookies)
.data(formData)
.method(Connection.Method.POST)
.userAgent("Mozilla")
.execute()
Log.d(TAG, "getData: ---------------------------------------$homePage")
}
catch (E:IOException){
Log.d(TAG, "getLoginPage: ----IO EXCEPTION----${E.message}")
}
}
这是我正在尝试使用的网站 请帮助!
30秒到达战场
相关分类