RE: LWP with SSL and Client Side Cookies...
| Newsgroups | gmane.comp.lang.perl.modules.lwp |
|---|---|
| Message-ID | <[email protected]> |
QUONIX WEB ADMIN wrote:
> I've tried using cookie_jar but I cant seem to get it to work.
Clarify... are you sure it isn't working? Maybe the site is expecting something else besides cookies.
> use LWP::UserAgent;
>
> $ua = LWP::UserAgent->new(keep_alive => 1);
> $ua->agent('Mozilla/5.0')
So at this point you'd add the line
$ua->cookie_jar(HTTP::Cookies->new());
> # Initial non-ssl request to homepage to grab cookies:
> #
> # JSESSIONID, serverName, and BIGipServerPROD-EXCHANGE-80
>
> my $response_a = $ua->get("http://www.intervalworld.com");
Note the domain... www.intervalworld.com
> # $response_a->header("set-cookie") now contains my three
> cookies # which I can grab with regular expressions.
>
> # Now I need to POST for login and insert those three cookies
> # in the request header.
>
> my %formdata = (
> login => "abc123",
> passwd => "xyz456",
> );
>
> # my $response_b =
> $ua->post("https://secure.intervalworld.com/web/cs", \%formdata )
Ah, the domain is different... www.intervalworld.com ne secure.intervalworld.com... so that is why the cookies aren't coming across.
All browsers will consider those two URLs to be on "different sites" because the server name is different, and won't pass cookies received on one to the other.
Maybe your inputs are incorrect? The form that I see shows three inputs named "a", "loginID", and "rememberMe".
--
Matthew.van.Eerde (at) hbinc.com 805.964.4554 x902
Hispanic Business Inc./HireDiversity.com Software Engineer