in reply to Re: Re: Re: Cookie Not Being Set
in thread Cookie Not Being Set
When I print out the request and response objects I see the cookie in the request, yet no cookie is sent back in the response or appears to get through. Perhaps the server is doing something there, if so it is strange.#!/usr/local/bin/perl -w use strict; use LWP::UserAgent; use HTTP::Cookies; use HTTP::Request::Common qw(POST GET);; use HTTP::Headers; use HTML::Parser; use URI; my $cururi; my $url; my @urls; my $sessionid; my $browser = LWP::UserAgent->new; my $email = 'xxxxxxxx'; my $password = 'xxxxxx'; my $req; my $res; #$browser->cookie_jar(HTTP::Cookies->new(file => 'cookie_jar', autosav +e => 1)); my $cookie_jar = HTTP::Cookies->new(file => 'cookie_jar', autosave => +1); $browser->cookie_jar($cookie_jar); my $initurl = "http://www.amazon.com/exec/obidos/flex-sign-in/ref=pd_n +fy_gw_si/"; &browserEmulation($initurl); open(CJ,"cookie_jar"); while (<CJ>) { chomp; if ($_ =~ /session-id\=\"(\d*-\d*-\d*)\"/) { $sessionid = $1; } } close(CJ); $url = "http://www.amazon.com/exec/obidos/flex-sign-in-done/$sessionid +"; #$res = $browser->simple_request(POST "$url", # { # 'email' => $email, # 'action' => 'sign-in checked', # 'next-page' => 'recs/instant-recs-sign-in-standard.ht +ml', # 'password' => $password, # 'method' => 'get', # 'opt' => 'oa', # 'page' => 'recs/instant-recs-register-standard.h +tml', # 'response' => 'tg/stores/static/-/goldbox/index/', # }); $req = POST $url, [ 'email' => $email, 'action' => 'sign-in checked', 'next-page' => 'recs/instant-recs-sign-in-standard.html', 'password' => $password, 'method' => 'get', 'opt' => 'oa', 'page' => 'recs/instant-recs-register-standard.html', 'response' => 'tg/stores/static/-/goldbox/index/', ]; $cookie_jar->add_cookie_header($req); $res = $browser->request($req); print $req->as_string(); print "\n\n=========================================================== +========\n\n"; print $res->as_string();
|
|---|