Hi all. I am having a bad week. things are not working as they should. Grin. Fix one problem ane another pops up.
I have been successful in logging into other sites using the identity method when a loging pop-up appears. But as yet, I have not been successful in using a loging form that is built into the web page. I believe I am doing this correct. the purpose of the script is to check for new books and eventually to do searches. Also to learn PWL. When I use the post approach, I receive the below from the request headers: loging: 1 trying to log in response: 302 Found headers: Cache-Control: private Date: Wed, 19 Jan 2011 04:39:17 GMT Location: https://www.x.net/signin.aspx? Server: Microsoft-IIS/6.0 Content-Length: 158 Content-Type: text/html; charset=utf-8 Client-Date: Wed, 19 Jan 2011 04:39:17 GMT Client-Peer: 2.4.3.2:80 Client-Response-Num: 1 Set-Cookie: ASP.NET_SessionId=414y4avh4fon1c451juvates; path=/; HttpOnly Set-Cookie: SkinID=1; domain=x.net; expires=Thu, 19-Jan-2012 04:39:17 GMT; path=/ Title: Object moved X-AspNet-Version: 2.0.50727 X-Powered-By: ASP.NET I have removed the actual correct ip addresses and web site for privacy reasons. the code I am using to log in is: use strict; use constant DEBUG => 0; use warnings; use LWP::UserAgent; use HTML::TokeParser; use URI; use HTML::TreeBuilder 3; my $web_page = 'http://www.x.net/c-60-my-books.aspx'; my $login_page = 'http://www.x.net/signin.aspx'; my $browser = LWP::UserAgent->new( ); # Simulation of browser tag. #$browser->agent("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.5; .NET CLR 2.0.50727; ffco7) Gecko/2008120122 Firefox/3.0.5"); # create an empty cooky jar. $browser->cookie_jar( {} ); my $username_label = "EMail"; # email label. my $password_label = "txtPassword"; my $user_id = 'name'; my $password = 'x'; my $response; # stores the response object. print "trying to log in\n"; $response = $browser->post( $login_page, [ $username_label => $user_id, $password_label => $password, 'LoginButton' => 'Login' ]); my $text = $response->status_line( ); print "response: $text \n"; my $headers = $response->headers_as_string( ); print "headers: $headers\n"; my $content = $response->content( ); Any clues on what is not working, would be welcomed. is it possible to login via the: $browser->identity ( ) approach? Sean
