Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

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{http://www.amazon.com/exec/obidos/ASIN/0394756673/r +ef=nosim/bookreadersre-20}; my $ua = LWP::UserAgent->new; $ua->agent('Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3 +) Gecko/20070309 Firefox/2.0.0.3'); 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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (11)
As of 2015-07-06 19:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (81 votes), past polls