inblosam has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to use LWP to log in to a SSL site. I have this code working on another SSL site, so the code shouldn't be too far off.
My first concern is that in the URL for the post there is a comment symbol (#). Is that an issue if I deference it? When I have "use strict" on I get this error:
Is there a problem with getting the cookies? Is there a SSL certificate issue? Are they doing something weird on their end? Here is my code I am using to do this:
Any help is appreciated. Thanks!
Michael Jensen
michael at inshift.com
http://www.inshift.com
My first concern is that in the URL for the post there is a comment symbol (#). Is that an issue if I deference it? When I have "use strict" on I get this error:
Line 18 is pointing to the POST line. When I take "use strict;" out I get the page hit, but an error. Here is the header and message returned from google:Bareword "login" not allowed while "strict subs" in use at (eval 28) l +ine 18. Bareword "login" not allowed while "strict subs" in use at (eval 28) l +ine 18.
HTTP/1.1 200 OK Connection: close Date: Fri, 14 Jun 2002 06:57:47 GMT Server: stronghold apache C2NetEU tomcat/1.0 Content-Type: text/html; charset=UTF-8 Client-Date: Fri, 14 Jun 2002 07:00:46 GMT Client-Response-Num: 1 Client-SSL-Cert-Issuer: /C=ZA/ST=Western Cape/L=Cape Town/O=Thawte Con +sulting cc/OU=Certification Services Division/CN=Thawte Server CA/Ema +il=server-certs@thawte.com Client-SSL-Cert-Subject: /C=US/ST=California/L=Mountain View/O=Google +Inc/CN=adwords.google.com Client-SSL-Cipher: EDH-RSA-DES-CBC3-SHA Client-SSL-Warning: Peer certificate not verified Client-Transfer-Encoding: chunked Link: ; rel="stylesheet" Servlet-Eng +ine: Tomcat Web Server/3.2 (final) (JSP 1.1; Servlet 2.2; Java 1.3.1_ +02; Linux 2.4.18-smp i386; java.vendor=Sun Microsystems Inc.) Set-Cookie: JSESSIONID=q93xd1cc51;Path=/select Set-Cookie2: JSESSIONID=q93xd1cc51;Version=1;Discard;Path="/select" Title: Google Adwords AdWords Select™ - It's All About Results™ Contact Us - Help 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.
Is there a problem with getting the cookies? Is there a SSL certificate issue? Are they doing something weird on their end? Here is my code I am using to do this:
#!/usr/lib/perl -w #use strict; use LWP::UserAgent; use Crypt::SSLeay; use HTTP::Request::Common; use HTTP::Cookies; use LWP::Simple; my $ua = LWP::UserAgent->new; $ua->cookie_jar(HTTP::Cookies->new(file => 'cookie_jar', autosave =>1) +); push @{ $ua->requests_redirectable }, 'POST'; my $request = $ua->request(POST "https://adwords.google.com/select/mai +n", { login.userid => 'test@test.com', login.password => 'testabc', cmd => 'LoginValidation', login => 'Login', }); $b = $request->as_string; print "$b\n";
Any help is appreciated. Thanks!
Michael Jensen
michael at inshift.com
http://www.inshift.com
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Error in SSL login via LWP
by Kanji (Parson) on Jun 14, 2002 at 07:41 UTC | |
by inblosam (Monk) on Jun 14, 2002 at 08:50 UTC | |
by Sinister (Friar) on Jun 14, 2002 at 09:01 UTC | |
Re: Error in SSL login via LWP
by cacharbe (Curate) on Jun 14, 2002 at 12:53 UTC |
Back to
Seekers of Perl Wisdom