Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: POSTing information on a web page

by Corion (Patriarch)
on Jun 16, 2008 at 14:25 UTC ( #692263=note: print w/replies, xml ) Need Help??

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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2022-07-02 11:50 GMT
Find Nodes?
    Voting Booth?
    My most frequent journeys are powered by:

    Results (103 votes). Check out past polls.