Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Simulate a Specific User Agent with LWP

by Arguile (Hermit)
on Oct 16, 2001 at 10:50 UTC ( #119075=note: print w/ replies, xml ) Need Help??


in reply to Simulate Connection using LWP

I was having a similar problem. You might want to look into $ua->agent("string"); in the LWP docs. It allows you to pass yourself off as whatever browser you wish.

I won't even get into what I think of people who require certain browsers, but unfortunately many do. If they're using server side detection badly, it can thrash the page or completely deny you entry. The answer is to mimic a browser that is allowed.

The most common restriction is a 4+ version browser, followed by requiring IE only. The following string should solve the problem in most cases:

Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)
Update: Fixed my horrid horrid late night grammar to just really bad late night grammar. ;)


Comment on Simulate a Specific User Agent with LWP
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2014-11-27 23:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (190 votes), past polls