Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
P is for Practical
 
PerlMonks

Maintaining PHP session in PERL

by lamp (Chaplain)
 | Log in | Create a new user | The Monastery Gates | Super Search | 
 | Seekers of Perl Wisdom | Meditations | PerlMonks Discussion | 
 | Obfuscation | Reviews | Cool Uses For Perl | Perl News | Q&A | Tutorials | 
 | Poetry | Recent Threads | Newest Nodes | Donate | What's New | 

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.

Comment on Maintaining PHP session in PERL
Re: Maintaining PHP session in PERL
by dpavlin (Pilgrim) 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...

Login:
Password
remember me
What's my password?
Create A New User

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 avoiding work at the Monastery: (19)
ikegami
jdporter
FunkyMonk
holli
Gavin
atcroft
salva
jwkrahn
jethro
kennethk
thezip
Eyck
LanX
trwww
gmargo
ssandv
je44ery
MikeDexter
im2
As of 2010-02-09 22:35 GMT
Sections?
The Monastery Gates
Seekers of Perl Wisdom
Meditations
PerlMonks Discussion
Categorized Q&A
Tutorials
Obfuscated Code
Perl Poetry
Cool Uses for Perl
Perl News
Information?
PerlMonks FAQ
Guide to the Monastery
What's New at PerlMonks
Voting/Experience System
Tutorials
Reviews
Library
Perl FAQs
Other Info Sources
Find Nodes?
Nodes You Wrote
Super Search
List Nodes By Users
Newest Nodes
Recently Active Threads
Selected Best Nodes
Best Nodes
Worst Nodes
Saints in our Book
Leftovers?
The St. Larry Wall Shrine
Offering Plate
Awards
Craft
Snippets Section
Code Catacombs
Quests
Editor Requests
Buy PerlMonks Gear
PerlMonks Merchandise
Planet Perl
Perlsphere
Use Perl
Perl.com
Perl 5 Wiki
Perl Jobs
Perl Mongers
Perl Directory
Perl documentation
CPAN
Random Node
Voting Booth?

What level of existential comfort do you require?

Palace
Executive suite at the best hotel
Regular hotel in a decent part of town
Motel
Boarding house
Sleeping Bag on Couch in Basement
Any port in a storm
Camping under the freeway overpass
Jail
Other

Results (283 votes), past polls