macosx  

Problems with Spidering Hack #56

Lola Lee
Sat, 15 Jan 2005 05:38:14 -0800

I'm working on my knowledge of Perl by working through Spidering Hacks (O'Reilly). Right now I'm stumped as to why this hack isn't working (code can be found at http://hacks.oreilly.com/pub/h/981#code.

There are several issues with this code, but the first one that comes up when I do a check syntax on it is this line:

         'next-page'   => 'recs/instant-recs-register-standard.html';

There's a syntax error either in this line, or immediately before it. In which case here's the entire section:

# Now log into Amazon.
my $ua = LWP::UserAgent->new;
$ua->agent("(compatible; MSIE 4.01; MSN 2.5; AOL 4.0; Windows 98)");
$ua->cookie_jar(HTTP::Cookies->new('file' => 'cookies.lwp', 'autosave' => 1));
my %headers = ( 'content-type' => "application/x-www-form-urlencoded" );
$ua->post($logurl,
[email => $email,
password => $password,
method => 'get',
opt => 'oa',
page => 'recs/instant-recs-sign-in-standard.html',
response => 'tg/recs/recs-post-login-dispatch/-/recs/pd_rw_gw_r',
'next-page' => 'recs/instant-recs-register-standard.html';
action => 'sign in checked' ], %headers);


I checked the documentation for LWP::UserAgent but there's nothing in it about next-page. So, what could be the problem?

I'm not sure if I should post the entire code here as it was originally published in a book, but this code is also available at the above link. Please advise me as to if it's okay to do so; if not there's the link where you can take a peek.


-- Lola - mailto:[EMAIL PROTECTED] http://www.lolajl.net | Blog at http://www.lolajl.net/blog/ Terrorism delenda est! (Terrorism must be destroyed utterly!) I'm in Bowie, MD, USA, halfway between DC and Annapolis.