Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Maintaining PHP session in PERL

by lamp (Chaplain)
on Feb 10, 2005 at 09:59 UTC ( #429647=perlquestion: print w/replies, xml ) Need Help??

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...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://429647]
Approved by fireartist
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2022-06-25 17:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My most frequent journeys are powered by:









    Results (83 votes). Check out past polls.

    Notices?