Gedanken,

Thanks for helping me. I was looking at the docs for Mechanize and the default behavior is to accept cookies. Shouldn't Mechanize have taken the cookie when it was set?

I searched on Google and CPAN and I couldn't find a good example of how to set a cookie manually. I was thinking I need to use the HTTP::Cookie module, but that only saves cookies
not how to add one. Besides, I couldn't find AnalysisUserID in the html code. Could you please help me on this a little more. I am not a perl wizard.



Joe.


On Aug 25, 2004, at 11:53 AM, Gedanken wrote:

On Wed, 25 Aug 2004, Gedanken wrote:

i just took a quick look.

after the initial 302 redirect, they are setting a cookie called
AnalysisUserID.  i would suspect that is failing.  id look at the
javascript code that generates that cookie, duplicate it yourself, and
manually 'give' yourself that cookie.

 On Wed, 25 Aug 2004, Joseph Alotta wrote:

my first guess without seeing the sites html code would be that you are
correctly sending the user-agent info, but one of 2 things is wrong:


  - you are missing a Host header in the request so i thinks you arent
 httpd 1.1 compliant

- some kind of javascript is executing to try and set a cookie and its
failing. i have seen many sites have some 'jscript=1' cookie to ensure
the client can handle their stuff. in this case, manually creating the
cookie and adding it to the cookie jar tricks the site into accepting you.


  Greetings,

I am trying to use WWW::Mechanize to get my account data. First thing
is
that the website tells me "Sorry you need Internet Explorer 4.O or
greater".


I think I have done everything to set it to be IE 6.O (Also 5.5). What
am
I doing wrong?



Thank you,

  Joe.






#!/usr/bin/perl # americanfunds - gets account info from american funds 401k website # use strict; use warnings; use WWW::Mechanize; use HTML::TreeBuilder; use HTML::TableExtract; use Data::Dumper; $Data::Dumper::Terse = 1; my $User_agent_id = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)';


my $m = WWW::Mechanize->new( autocheck => 1); $m->agent_alias( 'Windows IE 6' ); #$m->agent($User_agent_id);


main('12345678', '123456');

  sub main
  {
       my ($id, $pass) = @_;

       $m->get('http://www.americanfunds.com/retire'),
           or die "can't get initial americanfunds.com/retire screen";

       my $str = $m->content; print "1. $str\n";


$m->follow_link(n => 1 ) or die "can't get login screen";

       $str = $m->content; print "2. $str\n";

       exit;
  }




-- gedanken




Reply via email to