[英]apache httpclient and spawning a browser that will share the session
I'm have a java program that uses Apache httpclient api. 我有一个使用Apache httpclient api的java程序。 This is used to login to and communicate to a webapp. 这用于登录Web应用程序并与之通信。 Once logged in, there's a situation in which the program issues an execute process to open up firefox to hit the webapp and allow the user to see data in the browser. 登录后,程序会执行一个执行过程以打开firefox来攻击Web应用程序,并允许用户在浏览器中查看数据。 Since the java program is already logged in, is there a way to share that current session PHPSESSID so that the spawned firefox is already logged in and working in that same session? 由于Java程序已经登录,是否可以共享当前会话PHPSESSID,以便生成的Firefox已登录并在同一会话中工作?
You could write your own session handling callback functions that will store session data in a database. 您可以编写自己的会话处理回调函数,以将会话数据存储在数据库中。 Then all you need to do is pass the PHPSESSID along with the URL that you're opening in Firefox and you can continue the session from there. 然后,您需要做的就是传递PHPSESSID以及在Firefox中打开的URL,然后可以从那里继续会话。 Read more here: 在这里阅读更多:
http://www.php.net/manual/en/function.session-set-save-handler.php http://www.php.net/manual/zh/function.session-set-save-handler.php
There are some good examples of a databased session in the user comments 用户评论中有一些数据库会话的良好示例
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.