http://qs321.pair.com?node_id=429647

lamp has asked for the wisdom of the Perl Monks concerning the following question:

We are developing an application which will interact with another php application.
There we need to maintain the session of php application in our perl application.
From cpan.org, i got information about PHP::Session which is used
to maintain Perl application session shared with PHP.
Can anybody share some information on this module and other implementation options?

Thanks.

Replies are listed 'Best First'.
Re: Maintaining PHP session in PERL
by dpavlin (Friar) on Feb 10, 2005 at 13:44 UTC
    It's quite simple:
    #!/usr/bin/perl -w use strict; use PHP::Session; use CGI::Lite; use Data::Dumper; my $session_name = 'PHPSESSID'; # change this if needed print "Content-type: text/plain\n\n"; my $cgi = new CGI::Lite; my $cookies = $cgi->parse_cookies; if ($cookies->{$session_name}) { my $session = PHP::Session->new($cookies->{$session_name}); # now, try to dump _s_pod variable from session print "_s_pod:",Dumper($session->get('_s_pod')); } else { print "can't find session cookie $session_name"; }
    Disclamer: I'm still not using PHP::Session in production, but this seem to work good enough for me.
    Hum, should this example should go into module documentation?

    2share!2flame...