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

Firefox user agent in mechanize

by Anonymous Monk
on Jun 03, 2010 at 15:48 UTC ( #842943=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi, using mechanize to get a web page - darn thing redirects to download page if browser is not Firefox. I tried $mech->agent_alias('Firefox/3.5.7'); but it's not fooled! Anyone know what I can use? Thanks

Replies are listed 'Best First'.
Re: Firefox user agent in mechanize
by marto (Cardinal) on Jun 03, 2010 at 15:58 UTC

    Read the WWW::Mechanize docs, it lists the valid user agents. 'Firefox/3.5.7' isn't a valid user agent alias string. See also Firefox User Agent Strings.

    Update: Yes, I messed up, I meant to say'Firefox/3.5.7' isn't a valid user agent alias, rather than string. Thanks ikegami

      You mean it's not a valid user agent alias. It is a valid user agent string, which means it could be passed to ->agent(), but it's not one Firefox uses. You can get some agent string used by Firefox on this page.

        Ugg, yeah, thanks for the correction. My fault for doing too many things at once.

      golly, that's a nice link -thank you
Re: Firefox user agent in mechanize
by jonnyfolk (Vicar) on Jun 03, 2010 at 16:03 UTC
    $mech->agent('User-Agent=Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.7');
      That worked very nicely - thankee kindly

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://842943]
Approved by jonnyfolk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (1)
As of 2021-10-27 03:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (91 votes). Check out past polls.

    Notices?