Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: how to submit html form?

by gu (Beadle)
on Nov 27, 2005 at 19:26 UTC ( #512038=note: print w/ replies, xml ) Need Help??

in reply to how to submit html form?

It's as easy as :

use WWW::Mechanize ; my $m = WWW::Mechanize->new ; my %conf = ( foo => bar ) ; $m->get("http://your.url/") ; die $m->res->status_line unless $m->success ; # Choose form number $m->form_number(1) ; # Fill $m->set_fields( %conf ) ; # Submit $m->submit ; die $m->res->status_line unless $m->success ; # If the form sends you somewhere, you can catch it : my $url = $m->response->request->uri->as_string ;
Then if you want to process HTML data from a page, I recommend you use HTML::TreeBuilder, for example as :
$m->get("$url") ; die $m->res->status_line unless $m->success ; my $tree = HTML::TreeBuilder->new_from_content( $m->content ) ;


Comment on Re: how to submit html form?
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (8)
As of 2016-02-09 15:11 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (319 votes), past polls