自动登录到java中的安全网站?
作为我正在做的一个小项目的一部分,我需要能够登录到一个非常安全的网站并检索html
我一直在研究使用ApacheCommonsHttpClient来实现这一点。然而,我只是想确保这是可能的,因为这个网站是非常安全的,可能有sso方法登录? 如果可能,最好的方法是什么?登录后,我需要能够浏览大约三个页面,因此需要以某种方式存储cookie或会话
非常感谢
你可以在下面搜索框中键入要查询的问题!
作为我正在做的一个小项目的一部分,我需要能够登录到一个非常安全的网站并检索html
我一直在研究使用ApacheCommonsHttpClient来实现这一点。然而,我只是想确保这是可能的,因为这个网站是非常安全的,可能有sso方法登录? 如果可能,最好的方法是什么?登录后,我需要能够浏览大约三个页面,因此需要以某种方式存储cookie或会话
非常感谢
# 1 楼答案
是的,使用ApacheHTTP组件可以做到这一点,但是对于与复杂网站的交互,没有什么(我知道)比HtmlUnit更好。要使用HTTPC组件,你需要“脚本”整个HTTP请求序列,如果中间的任何东西依赖于动态内容/JavaScript,就会出现问题。p>
另一方面,HtmlUnit几乎是一个完整的“盒子中的bowser”,您可以在更高的级别编写交互脚本-单击此按钮,填写这些值,提交等等
# 2 楼答案
你需要jsoup。将响应发送到特定网站的jar文件 通过检查元素验证查看gmail表单数据