Notheros
Notheros

Reputation: 2247

PHP cookies on Perl

I'll go straight to the question.

How to read a PHP cookie using Perl? It's seems to be a stupid question, but I just can't make it work.

I'm using a proxy. If cookie exists do this, if not do that. So, regardless of what website I'm requesting, I need to check this cookie.

My PHP script created a cookie called "phpcookie". Now I want to retrieve it's value with Perl with the following script.

    use strict; 
    use CGI qw/:standard/; 
    use CGI::Cookie;

    my $cgi = new CGI; 
    my $ck = $cgi->cookie('phpcookie');

$ck always returns blank.

Am I forgetting something?

Upvotes: 0

Views: 127

Answers (1)

mpapec
mpapec

Reputation: 50667

You can inspect all cookies sent by browser and check for phpcookie,

use strict;
use Data::Dumper;
use CGI qw/:standard/; 

my $cgi = new CGI; 
my @arr = $cgi->cookie();
print Dumper \@arr;

Upvotes: 2

Related Questions