in reply to LWP, SSL, cookie session?

Okay, now I am using res instead of req (I should have seen that). Now I get this message again (old node):
Sorry, we're unable to process this request. There are two possible ca +uses for this error: You accessed this page via a bookmark instead of entering through the +AdWords Select homepage You have disabled cookies in your browser.

My LWP::Debug gives me this about the cookies, if that helps:
LWP::Protocol::collect: read 1019 bytes LWP::Protocol::collect: read 429 bytes LWP::Protocol::collect: read 1019 bytes LWP::Protocol::collect: read 255 bytes HTTP::Cookies::extract_cookies: Set cookie JSESSIONID => 49d3aidt74 LWP::UserAgent::request: Simple response: OK LWP::UserAgent::request: () HTTP::Cookies::add_cookie_header: Checking adwords.google.com for cook +ies HTTP::Cookies::add_cookie_header: - checking cookie path=/select HTTP::Cookies::add_cookie_header: - checking cookie JSESSIONID=49d3ai +dt74 HTTP::Cookies::add_cookie_header: it's a match HTTP::Cookies::add_cookie_header: Checking .google.com for cookies HTTP::Cookies::add_cookie_header: Checking google.com for cookies HTTP::Cookies::add_cookie_header: Checking .com for cookies LWP::UserAgent::send_request: GET https://adwords.google.com/select/ma +in?cmd=CampaignManagement&campaignid=0&timeperiod=simple&timeperiod.s +impletimeperiod=today LWP::UserAgent::_need_proxy: Not proxied LWP::Protocol::http::request: () LWP::Protocol::collect: read 1019 bytes LWP::Protocol::collect: read 1648 bytes HTTP::Cookies::extract_cookies: Set cookie JSESSIONID => 4iwdeedt77 LWP::UserAgent::request: Simple response: OK

The only thing I can see "unusual" is two different "JSESSIONID" id's, one being set and read, and the other one being set again.
This is my latest code:

#!/usr/lib/perl -w use strict; use LWP::UserAgent; use Crypt::SSLeay; use HTTP::Request::Common; use HTTP::Cookies; use LWP::Simple; use LWP::Debug qw(+); my $ua = LWP::UserAgent->new; $ua->cookie_jar(HTTP::Cookies->new(file => "cookie_jar", autosave => 1 +)); $ua->timeout(500); my $req = POST 'https://adwords.google.com/select/main', ['login.userid' => 'test@test.com', 'login.password' => 'testabc', 'cmd' => 'LoginValidation', 'login' => 'Login' ]; my $res = $ua->request($req); unless ($res->is_success) { print "Login Failed: : ". $res->status_line . "\n"; return 0; } my $b = $res->as_string; print "\n\n\nThe 1st result is:\n$b\n"; my $req = HTTP::Request->new(GET=>'https://adwords.google.com/select/m +ain?cmd=CampaignManagement&campaignid=0&timeperiod=simple&timeperiod. +simpletimeperiod=today'); my $res = $ua->request($req); my $c = $res->content; print "\n\n\nThe 2nd result is:\n$c\n";


Michael Jensen
michael at inshift.com
http://www.inshift.com

Replies are listed 'Best First'.
Re: Re: LWP, SSL, cookie session?
by u914 (Pilgrim) on Jun 18, 2002 at 16:25 UTC
    Well, the issue is likely related to either cookies, or to the http_referer string....

    your error:
    Sorry, we're unable to process this request. There are two possible causes for this error:

    You accessed this page via a bookmark instead of entering through the AdWords Select homepage
    this one is probably because there is no http_referer set in the LWP au

    You have disabled cookies in your browser.

    this one is because the jsession id has changed

    The answer to these is probably to use LWP to get the page first, ie, establish a session... and then after that, return the form (jsession included) as it was presented.

    good luck!

      Any ideas where I can find out how to implement that? I thought I was establishing a session by logging in (the login isn't passing any session ID along with it, is it? or is it part of a cookie set when just visiting the login page?). How do I "return the form as it was presented"? I am matching the exact login form, I thought. Thanks for the help!

      Michael Jensen
      michael at inshift.com
      http://www.inshift.com