What I'm attempting to do is login to amazon.com with my account and then download a copy of their products page. I need to be logged in in order to see all of the prices listed.
This originally worked last week, but after making no changes to it, it stopped today.
I was not able to login directly to amazon.com as their login page was not being submitted no matter what I tried. So I used their affiliate login page and was able to successfully login and can confirm this by the page returned. But I no longer stay logged in when I try to download the different products page.
Thanks so much in advance for any help that can be provided.
#!/usr/bin/perl use WWW::Mechanize; use HTTP::Cookies; my $url = "https://affiliate-program.amazon.com/"; my $appurl = "https://www.amazon.com/gp/bestsellers/videogames"; my $username = 'xxxxx'; my $password = 'xxxxx'; my $mech = WWW::Mechanize->new(autocheck => 1); $mech->cookie_jar(HTTP::Cookies->new()); $mech->get($url); $mech->form_name('sign_in'); $mech->field(email => $username); $mech->field(password => $password); $mech->submit(); my $login_content = $mech->content(); # go to an amazon url $mech->get($appurl); my $app_content = $mech->content(); open(IFP,"> amazontest.html "); print IFP $app_content; close IFP;
In reply to Using Mechanize to get website content by techtoys
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |