我一直在尝试开发一个小应用程序,从我的学术页面获取验证码,将其显示给用户,用户输入验证码,程序应显示详细信息。 但是,我被困在登录页面本身。 我使用jsoup获取cookie,将验证码保存到文件夹,使用之前的cookie提交验证码和表单数据。 但我再次获得相同的登录页面。 请帮忙!
这是获取请求。 网站网址https://academics.vit.ac.in/parent/parent_login.asp
Response res = Jsoup.connect(webSiteURL).method(Method.GET).execute(); Map<String,String> cook = res.cookies(); String sessionid = res.cookie("ASPSESSIONIDSQHDAQRQ");获得验证码后,这是发布请求。
Response login = Jsoup.connect(webSiteURL) .userAgent("Mozilla/5.0") .cookie("ASPSESSIONIDSQHDAQRQ", sessionid). data("message","Enter Verification Code of 6 characters exactly as shown.") .data("vrfcd",captcha).data("wdpswd","somedata").data("wdregno","somedata") .method(Method.POST).execute(); System.out.println(login.parse());当我试着这个
System.out.println(login.cookies());值为null,是一个线索? 帮帮我!! 谢谢!!
I have been trying to develop a small application that gets captcha from my academics page, displays it to the user, the user enters captcha and the program should display details. However, I am stuck at login page itself. I used jsoup to get the cookie,save captcha to a folder, submit captcha along with form data, using the previous cookie. But I get the same login page again. Please help!
This is the get request. Website url https://academics.vit.ac.in/parent/parent_login.asp
Response res = Jsoup.connect(webSiteURL).method(Method.GET).execute(); Map<String,String> cook = res.cookies(); String sessionid = res.cookie("ASPSESSIONIDSQHDAQRQ");After getting the captcha, this is the post request.
Response login = Jsoup.connect(webSiteURL) .userAgent("Mozilla/5.0") .cookie("ASPSESSIONIDSQHDAQRQ", sessionid). data("message","Enter Verification Code of 6 characters exactly as shown.") .data("vrfcd",captcha).data("wdpswd","somedata").data("wdregno","somedata") .method(Method.POST).execute(); System.out.println(login.parse());When I tried this
System.out.println(login.cookies());The value is null, is that a clue?? Help me out!! Thanks!!
最满意答案
您确定要使用cookie检索验证码吗? 请检查一下。 我的意思是,您可以下载验证码,例如:
Response res1 = Jsoup.connect("https://academics.vit.ac.in/parent/captcha.asp") .cookie("ASPSESSIONIDSQHDAQRQ", sessionid) .ignoreContentType(true) .method(Method.GET).timeout(30000).execute();然后确保在登录帖子中使用正确的URL,即:
https://academics.vit.ac.in/parent/parent_login_submit.asp那它应该工作正常。
希望能帮助到你。
Are you sure you are retrieving the captcha using the cookie too?. Please check that. I mean, you can download the captcha with something like:
Response res1 = Jsoup.connect("https://academics.vit.ac.in/parent/captcha.asp") .cookie("ASPSESSIONIDSQHDAQRQ", sessionid) .ignoreContentType(true) .method(Method.GET).timeout(30000).execute();Then be sure that in the login post you are using the correct url, that is:
https://academics.vit.ac.in/parent/parent_login_submit.aspThen it should work fine.
Hope it helps.
Jsoup captcha登录用cookie(Jsoup captcha login with cookie)我一直在尝试开发一个小应用程序,从我的学术页面获取验证码,将其显示给用户,用户输入验证码,程序应显示详细信息。 但是,我被困在登录页面本身。 我使用jsoup获取cookie,将验证码保存到文件夹,使用之前的cookie提交验证码和表单数据。 但我再次获得相同的登录页面。 请帮忙!
这是获取请求。 网站网址https://academics.vit.ac.in/parent/parent_login.asp
Response res = Jsoup.connect(webSiteURL).method(Method.GET).execute(); Map<String,String> cook = res.cookies(); String sessionid = res.cookie("ASPSESSIONIDSQHDAQRQ");获得验证码后,这是发布请求。
Response login = Jsoup.connect(webSiteURL) .userAgent("Mozilla/5.0") .cookie("ASPSESSIONIDSQHDAQRQ", sessionid). data("message","Enter Verification Code of 6 characters exactly as shown.") .data("vrfcd",captcha).data("wdpswd","somedata").data("wdregno","somedata") .method(Method.POST).execute(); System.out.println(login.parse());当我试着这个
System.out.println(login.cookies());值为null,是一个线索? 帮帮我!! 谢谢!!
I have been trying to develop a small application that gets captcha from my academics page, displays it to the user, the user enters captcha and the program should display details. However, I am stuck at login page itself. I used jsoup to get the cookie,save captcha to a folder, submit captcha along with form data, using the previous cookie. But I get the same login page again. Please help!
This is the get request. Website url https://academics.vit.ac.in/parent/parent_login.asp
Response res = Jsoup.connect(webSiteURL).method(Method.GET).execute(); Map<String,String> cook = res.cookies(); String sessionid = res.cookie("ASPSESSIONIDSQHDAQRQ");After getting the captcha, this is the post request.
Response login = Jsoup.connect(webSiteURL) .userAgent("Mozilla/5.0") .cookie("ASPSESSIONIDSQHDAQRQ", sessionid). data("message","Enter Verification Code of 6 characters exactly as shown.") .data("vrfcd",captcha).data("wdpswd","somedata").data("wdregno","somedata") .method(Method.POST).execute(); System.out.println(login.parse());When I tried this
System.out.println(login.cookies());The value is null, is that a clue?? Help me out!! Thanks!!
最满意答案
您确定要使用cookie检索验证码吗? 请检查一下。 我的意思是,您可以下载验证码,例如:
Response res1 = Jsoup.connect("https://academics.vit.ac.in/parent/captcha.asp") .cookie("ASPSESSIONIDSQHDAQRQ", sessionid) .ignoreContentType(true) .method(Method.GET).timeout(30000).execute();然后确保在登录帖子中使用正确的URL,即:
https://academics.vit.ac.in/parent/parent_login_submit.asp那它应该工作正常。
希望能帮助到你。
Are you sure you are retrieving the captcha using the cookie too?. Please check that. I mean, you can download the captcha with something like:
Response res1 = Jsoup.connect("https://academics.vit.ac.in/parent/captcha.asp") .cookie("ASPSESSIONIDSQHDAQRQ", sessionid) .ignoreContentType(true) .method(Method.GET).timeout(30000).execute();Then be sure that in the login post you are using the correct url, that is:
https://academics.vit.ac.in/parent/parent_login_submit.aspThen it should work fine.
Hope it helps.
发布评论