Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   How to print out the value of a Cookie? (http://www.velocityreviews.com/forums/t881513-how-to-print-out-the-value-of-a-cookie.html)

marmot101 07-29-2003 07:28 PM

How to print out the value of a Cookie?
 
Hi, All,

Using CGI, I get a response from server which plant a Cookie in client
machine. Now I can get this Cookie, but I don't know how to print out the
value of this Cookie? I checked online manual, but seems none method works.
Can anyone help me?

Many thanks!

marmot101

############## My Source Code ####################
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Cookies;
use HTTP::Request::Common qw(POST);

my $agent = LWP::UserAgent->new();

my $url = 'http://***';
my $content = [ 'UserName' => '***', 'Password' => '***' ];
my $request = POST $url, $content;

my $response = $agent->request($request);

if ($response->is_success) {
print "Yes, it is success\n";
print $response->content;

$cookie_jar = new HTTP::Cookies->new;
$cookie_jar->extract_cookies($response);

# How to print out value of Cookie here?
# print "Cookie = ", $cookie_jar{'Stamp'}->value; # doesn't work
}



Charles DeRykus 08-18-2003 06:44 PM

Re: How to print out the value of a Cookie?
 
In article <BVzVa.78$xq3.40414@news.uswest.net>,
marmot101 <marmot101@yahoo.com> wrote:
>Hi, All,
>
>Using CGI, I get a response from server which plant a Cookie in client
>machine. Now I can get this Cookie, but I don't know how to print out the
>value of this Cookie? I checked online manual, but seems none method works.
>....
># How to print out value of Cookie here?
># print "Cookie = ", $cookie_jar{'Stamp'}->value; # doesn't work
>}


Perhaps the as_string method...?

print $cookie_jar->as_string

--
Charles DeRykus


All times are GMT. The time now is 04:54 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.