Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

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

by naikonta (Curate)
on Nov 16, 2007 at 04:22 UTC ( #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!


Comment on Re: use WWW::Mechanize or LWP to interface with WEB
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (12)
As of 2014-12-26 13:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (171 votes), past polls