I am having trouble accessing a cookie through perl/cgi - the cookie has been set in a php script like this:
$login = array();
$login[value1] = $user_name;
$login[value2] = $set_status;
$serialized = serialize($login);
$urlencoded = urlencode($serialized);
// set the cookie
setcookie("login", $urlencoded, time()+3600);
I have no problems accessing this cookie via php with the following code:
if(isSet($login))
{
$urldecoded = urldecode($login);
$unserialized = unserialize($urldecoded);
$user_name = $unserialized[value1];
$status = $unserialized[value2];
}
but when I try to access it via perl, with the following code, I get nothing back:
$Cgi = new CGI;
Retrieve the variables from previously set cookies.
Retrieves nothing if the cookie is not set.
Cookie should contain something like this:
%login = {
user_name => 'John Doe',
status => 'default' or 'custom',
}
%login = $Cgi->cookie(-name =>'login');
print $login{'user_name'};
The hash %login contains nothing??????
Why is this?
It seems as though setting a cookie in php, is only accessible via php?
If anybody has any solution to this (I need to be able to check the cookie via cgi), I would appreciate any comments or help.
Thanks,
Darren