Hi Bruce,

On Aug 25, 2004, at 9:15 PM, bruce wrote:

joe/joseph....

when you're creating apps that require you to either do a form submission,
or a cookie... it helps if you are able to see what the web app actually
sends between the server and the browser. this tends to help track down
issues with cookies/redirects/etc...


i would strongly advise you to find an app/proxy that might allow you to
access the site via a regular browser, while capturing the traffic between
the browser/website.

Yes, I know. It is like flying blind. I can do much better coding when I can see what things are going on. I am looking for something like you advise.


as far as the cookie goes, you shouldn't have to set a cookie on your client
app that's accessing the website. remember, what you're doing is trying to
quickly emualte a basic browser function in a programatic manner, in order
to access the site. think about it for a sec... a normal browser doesn't
have to 'set' a cookie before it's ever been to the site!!!

Theoretically, you are right. However, Mechanize is not a full-featured browser and
it doesn't do all the javascript things, so we have to do them manually.


if you're still having issue with your app, let me know. i may have some
sample perl that might be able to walk you through some of what you're going
through...

Gedanken, said that he will find out how I need to set the cookie. Once I get past this, I think I can handle the rest. I have written a few Mechanize programs and it seems this is the odd case, that other websites are easier to deal with.


Thank you for you help.


Joe.





peace...



-----Original Message-----
From: Joseph Alotta [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 25, 2004 6:57 PM
To: [EMAIL PROTECTED]
Subject: Re: Website thinks Mech is MSIE < 4.0


Hi Gedanken,

Thanks again for your help.  I put in the line that sets the cookie and
I looked at the hmtl and found a number to put in the some-crazy-number
field, but I guess it was the wrong number.   I cut out all the other
stuff in my program to make it simpler and here is a copy so you can
see the whole thing.

Thanks again.

Joe.


[Abba:~/oldperlcode] josephal% lite 1. http://pr.retire.americanfunds.com 2. http://pr.retire.americanfunds.com/incompatible.html [Abba:~/oldperlcode] josephal% cat lite #!/usr/bin/env perl # americanfunds - downloads 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 $m = WWW::Mechanize->new( autocheck => 1);
$m->agent_alias( 'Windows IE 6' );


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";


$m->cookie_jar()->set_cookie(1, "AnalysisUserID", "1078445853225", "/", "pr.retire.americanfunds.com");


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


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

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

     exit;


# # simulate logging in with TIN/PIN #

     $m->submit_form(
         form_name => 'login',
         fields => {
             partssn => $id,
             partpin => $pass,
         },
     ) or die "can't login";
}
[Abba:~/oldperlcode] josephal%




Reply via email to