且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用jsoup登录网站

更新时间:2023-12-03 21:39:22

您应同时使用getpost:
首先,您必须将不带参数的get请求发送到URL- http://kortladdning3. chalmerskonferens.se/Default.aspx .服务器回复一些cookie,以及稍后将使用的两个值-__VIEWSTATE__EVENTVALIDATION.这些值因请求而异,因此您不能像以前那样使用硬编码的值.
提取这些值后,发送post请求,并使用与现在相同的字段.
您可以在此处查看非常相似的过程-提交登录问题Jsoup的表单

You should use both get and post:
First you have to send get request with no parameters to the URL - http://kortladdning3.chalmerskonferens.se/Default.aspx. The server replies with some cookies, and two values you'll use later - __VIEWSTATE and __EVENTVALIDATION. These values vary from request to request, so you can't use hard-coded values like you did.
After extracting these values, send post request, with the same fields you do now.
You can look at a very similar procedure here - Problems submitting a login form with Jsoup