java 使用java登录网站

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5242593/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 10:10:16  来源:igfitidea点击:

Logging into a website using java

javaautologin

提问by sreejith

I'm looking for a solution to login to a website using a java program.

我正在寻找一种使用 java 程序登录网站的解决方案。

I found a good script over here:

我在这里找到了一个很好的脚本:

http://www.dreamincode.net/forums/blog/114/entry-2715-login-to-a-website-from-java/

http://www.dreamincode.net/forums/blog/114/entry-2715-login-to-a-website-from-java/

But the trouble is with handling cookies? How can I get the cookie info. send by the server? Thanks

但问题在于处理cookies?如何获取cookie信息。由服务器发送?谢谢

回答by Bassem Reda Zohdy

Check JAAS, to use it for automatic log-in and if you are using IBM WebSphere check "Trust Association Interceptor"

检查JAAS,将其用于自动登录,如果您使用的是 IBM WebSphere,请检查“Trust Association Interceptor”

回答by deenfirdoush

Use HtmlUnit Framework. or Apache httpclient framework.

使用 HtmlUnit 框架。或 Apache httpclient 框架。