简体   繁体   中英

Unable to read a cookie from perl when set by a php webpage

I have 2 webpages under the same host. 1 in php and 1 in perl cgi.

The php page is setting a cookie "c" under a domain "d.com" and path "/".

In perl I am trying to read the value of the cookie "c".

I tried the following code :

use CGI;    
use CGI::Cookie;

my $query = new CGI;
print $query->header();
#... some more code ...
$thecookie = $query->cookie(-name=>'c', -domain=>"d.com", -path=>"/");
print $thecookie;

Any help/idea would be appreciated.

Thanks.

For anyone that had this issue. The solution was simple .

The problem is that the cookie was set to "secure" which force the browser to send the cookie only over https .

Since the perl page was accessed via http , the browser was not returning the cookie. Simple as that.

Accessing the page via https fixed the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM