in reply to POSTing information on a web page

I think you're going a quite roundabout way to filling in the form using WWW::Mechanize. WWW::Mechanize itself takes care of sending a correct Referer header, and you can fill in a form directly if you know the fields that are on it:

# Select the login form $mech->form_with_fields('user_name','user_pass'); $mech->set_fields( user_name => 'username', user_pass => 'secr1t' ); $mech->click('login'); print $mech->content;

Replies are listed 'Best First'.
Re: POSTing information on a web page
by b10m (Vicar) on Jun 16, 2008 at 15:22 UTC

    And if you'd need a different referer header, why not add it yourself? How to do that is in the POD.

    Update: as Corion pointed out, using for links isn't really nice, but since the real URL doesn't go through the Perlmonks parser, I don't really have an other option. The link is going to CPAN and yes, SFW.

Re^2: POSTing information on a web page
by clone4 (Sexton) on Jun 16, 2008 at 17:32 UTC
    yeah I know, but still can't get it working, even with your code snippet, it says it can't find any form including these fields,which probably means I don't pass the page correctly.I guess I gotta read up more on how to correctly use this module, because it still makes me quite confused