Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: LWP simple question

by imp (Priest)
on May 24, 2007 at 04:04 UTC ( #617161=note: print w/ replies, xml ) Need Help??

in reply to LWP simple question

They are probably just checking the user agent. This worked for me:

#!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; my $amazon_url = q{ +ef=nosim/bookreadersre-20}; my $ua = LWP::UserAgent->new; $ua->agent('Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: +) Gecko/20070309 Firefox/'); my $response = $ua->get($amazon_url); my $page = $response->content; my $sought_string = q{offer-listing}; if ($page =~ /$sought_string/){ print "Found it\n"; } else { print "No luck\n"; }

Comment on Re: LWP simple question
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://617161]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (13)
As of 2015-08-03 22:32 GMT
Find Nodes?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...

    Results (58 votes), past polls