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

Hi Monks,

How can I see the request headers for Perl mechanize get? I am getting the response headers but I need to verify the request also. How ca I get this.

Thanks in advance.

  • Comment on How to see WWW:Mechanize request headers

Replies are listed 'Best First'.
Re: How to see WWW:Mechanize request headers
by Corion (Patriarch) on Aug 26, 2014 at 16:47 UTC
      Thanks Corion, thats a good idea, will check it... :)
Re: How to see WWW:Mechanize request headers
by Your Mother (Archbishop) on Aug 26, 2014 at 18:03 UTC

    :P

    perl -MWWW::Mechanize -le'print WWW::Mechanize->new->get("http://perlm +onks.org")->request->as_string' GET http://perlmonks.org Accept-Encoding: gzip User-Agent: WWW-Mechanize/1.60

    The $mech->request object is an HTTP::Request so you can use ->header and such on it.

      Thanks YM, it worked.. :)