Question

I'm creating a Java applet which communicate with my PHP website by requesting pages and retrieving their contents. It works pretty well, and it allows my applet to use PHP sessions.

However, I tried to launch the applet with Opera (instead of Firefox), and it appears that Opera doesn't let my applet use its PHP session, and as Java (or at least IcedTea) doesn't handle PHP sessions itself, I can't make my applet work.

Is there any way to make Java be able to handle PHP sessions?

Was it helpful?

Solution

You would have to carry the PHP session ID in every query. That is, make a start_session.php which returns only the result of session_start(); and echo session_id() and use that number in the subsequent queries, that is, other.php?sid=XXXXX inside other.php use session_id($_GET['sid']); to start the session.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top