Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://617161]
[Corion]: Hi choroba, Discipulus!
[Corion]: choroba: It's currently evening for you, isn't it? Or are you up in the middle of the night?

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2017-02-23 08:59 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (342 votes). Check out past polls.