Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: WWW::Mechanize's affect on hidden fields

by Anonymous Monk
on Mar 19, 2011 at 03:10 UTC ( [id://894100]=note: print w/replies, xml ) Need Help??


in reply to WWW::Mechanize's affect on hidden fields

Does anyone know if hidden fields have to be filled in or does the form use them automatically with the module?

If you're selecting a form and then submitting it, hidden fields are sent, HTML::Form makes sure of that

Every time I have a question like this, I write a program

#!/usr/bin/perl -- use strict; use warnings; use WWW::Mechanize; use URI::file; my $ua = WWW::Mechanize->new(); $ua->timeout( 0.1 ); $ua->get( URI::file->new( __FILE__ ) ); $ua->add_handler("request_send", sub { shift->dump; return }); $ua->add_handler("response_done", sub { shift->dump; return }); $ua->form_number(0); $ua->submit; #~ <form action="http://127.0.0.1:666666/" enctype="multipart/form-dat +a" method="post"> #~ <input name="HIDER" value="REDIH" type="hidden"> #~ <input type="button" name="button1" value="click1" /> #~ <input TYPE="checkbox" VALUE=3 NAME="foo" CHECKED> #~ <input type="text" name="hi"> #~ <input type="submit" name=".submit" /> #~ </form> __END__ POST http://127.0.0.1:666666/ Accept-Encoding: gzip Referer: file:///D:/dev/misc/mechanize.hidden.pl User-Agent: WWW-Mechanize/1.66 Content-Length: 189 Content-Type: multipart/form-data; boundary=xYzZY --xYzZY\r Content-Disposition: form-data; name="HIDER"\r \r REDIH\r --xYzZY\r Content-Disposition: form-data; name="foo"\r \r 3\r --xYzZY\r Content-Disposition: form-data; name="hi"\r \r \r --xYzZY--\r\n 500 Can't connect to 127.0.0.1:666666 (timeout) Content-Type: text/plain Client-Date: Sat, 19 Mar 2011 03:08:12 GMT Client-Warning: Internal response Can't connect to 127.0.0.1:666666 (timeout)\n LWP::Protocol::http::Socket: connect: timeout at C:/perl/site/5.12.2/l +ib/LWP/Protocol/http.pm line 51.\n Error POSTing http://127.0.0.1:666666/: Can't connect to 127.0.0.1:666 +666 (timeout) at D:\dev\misc\mechanize.hidden.pl line 24

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-03-28 18:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found