kretch has asked for the wisdom of the Perl Monks concerning the following question:
$| = 1 ; use warnings ; use LWP::UserAgent; use HTTP::Cookies; use HTTP::Request::Common; use MD5; use strict; use Data::Dumper ; my $cookie_jar = HTTP::Cookies->new( file => $ENV{'HOME'}."/lwp_cookies.dat", autosave => 1, ); my $ua = LWP::UserAgent->new; $ua->proxy(['https','http','ftp'] => 'myinfo@myproxy') ; $ua->cookie_jar($cookie_jar) ; $ua->agent('Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.1 +1) Gecko/20071127 Firefox/2.0.0.11') ; my $response = $ua->post( 'https://shop.safeway.com/register/registernew.asp?signin +=1&returnTo=', [ "register" => '0', "rzipcode" => '90210', "zipcode" => '90210' ] ); die ("Error:", $response->status_line) unless $response->is_success ; $number = 142100398 ; my $url = "http://shop.safeway.com/dnet/RichProductInformation.aspx? +promo_windows=0&bpn=$number"; my $request = HTTP::Request->new('GET',$url); $request->protocol('HTTP/1.1') ; my $response2 = $ua->request($request) ; open (FILE,">$number".".html") || die ("cannot open file for write\n +"); print $response2->status_line."\n"; print FILE $response2->content ; close (FILE) ;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problems using LWP::UserAgent to log into safeway.com
by Gangabass (Vicar) on Jan 23, 2008 at 03:47 UTC | |
by kretch (Initiate) on Jan 23, 2008 at 05:29 UTC | |
by Gangabass (Vicar) on Jan 24, 2008 at 02:18 UTC | |
|
Re: Problems using LWP::UserAgent to log into safeway.com
by Cody Pendant (Prior) on Jan 23, 2008 at 03:50 UTC | |
by kretch (Initiate) on Jan 23, 2008 at 05:33 UTC | |
by Cody Pendant (Prior) on Jan 23, 2008 at 11:06 UTC |