Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: use WWW::Mechanize or LWP to interface with WEB

by naikonta (Curate)
on Nov 16, 2007 at 04:22 UTC ( [id://651123]=note: print w/replies, xml ) Need Help??


in reply to use WWW::Mechanize or LWP to interface with WEB

You should select the form first to work on after the get() method. Saying $mechObject->form_number(1) means that work on the form number 1, which is the only form in the HTML. The field() method works on a single field, so you have to call it twice for to fill in two fields. The click() method returns HTTP::Response object so you may interested the clicking result or the content returned by the server.
my $resp = $mechObject->click; die "Submit failed\n" if $resp->is_error; my $content = $resp->content; # do something with $content if necessary
However, if you have problem due the the JavaScript in the HTML source, check mechanize and javascript.

Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-03-29 08:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found