JSoup登录和Cookie [英] JSoup Login and Cookie

查看:556
本文介绍了JSoup登录和Cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用JSoup登录网站,但我无法获取好的Cookie。

I'm trying to login into a site using JSoup but I'm having trouble getting a good cookie back.

我不确定网址或登录数据不正确。任何帮助将非常感激。

I'm not sure if the URL or login data is incorrect. Any help would be much appreciated.

登录页面这里

我目前正在尝试使用以下代码:

I'm currently trying with the following code:

Connection.Response res = Jsoup.connect("https://go.sfu.ca/psp/goprd/?cmd=login&languageCd=ENG")
                    .data("user", "myUserID", "pwd", "myPassword")
                    .method(Connection.Method.POST)
                    .execute();

如果我是
登录,我不会得到相同数量的cookie信息浏览器,并且无法请求您登录所需的页面。

I do not get the same amount of cookie information if I were to login in a browser and cannot request the pages that are required for you to be logged in.

任何帮助将非常感谢!
感谢。

Any help would be greatly appreciated!! Thanks.

推荐答案

我缺少表单中的Login参数。包括后,我能够得到一个好的cookie回来。

I was missing the Login parameter in the form. After including that I was able to get a good cookie back.

这篇关于JSoup登录和Cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆