Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a Java library for decoding php session data?

Tags:

java

php

session

I am working on an application that mixes php and Java. I need to inject some values into the php session through Java, but to do this I need to be able to parse the values of the php session into a set. Is there a library that will let me undo in Java what session_encode does in php?

like image 691
stevebot Avatar asked Nov 06 '22 04:11

stevebot


1 Answers

You can configure your PHP environment to store the session data in WWDX format http://www.php.net/manual/en/session.configuration.php#ini.session.serialize-handler

session.serialize_handler defines the name of the handler which is used to 
  serialize/deserialize data. Currently, a PHP internal format (name php or php_binary) 
  and WDDX are supported (name wddx). WDDX is only available, 
  if PHP is compiled with WDDX support. Defaults to php.`

About WDDX:

The Web Distributed Data Exchange, or WDDX, is a free, open XML-based technology that allows Web applications created with any platform to easily exchange data with one another over the Web.

and the Java WDDX Parser available via googling :) http://www.google.com.ua/search?q=java+wddx+parser

Ofcourse this solution is more complex than just write simple parser class – the PHP session format is really simple.

like image 157
Vadim Avatar answered Nov 09 '22 12:11

Vadim