By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
463,092 Members | 579 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 463,092 IT Pros & Developers. It's quick & easy.

Using perl Mech to fill out a php script when there is no 'form' tag

P: 1
This is my first exposure to perl Mech when I am trying to autofill a php script. As per perl Mechaize docs, there are numerous functions to fill out a text field and submit. However, what if the script doesn't have any form tag? Such as this one below:

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body>
  3. Enter Hostname:
  4.         <input type="text" name="host_name" id="host_input"/>
  5.         <input type="submit" value="Investigate!" onClick="populate();"/> 
  6. <br/>
  7. </body>
  8. </html>
For brevity's sake, have only produced relevant html source here. There is no mention of a form tag anywhere in this php page. It displays a text field for entering host name and a submit button which when clicked calls a php function 'populate()'.

How can I fill up/submit this form when there is no form tag?

Expand|Select|Wrap|Line Numbers
  1. my $mech=WWW::Mechanize->new(autocheck=>1);
  2. $mech->cookie_jar($cookie_jar);
  3. $mech->get($url);
On examining the $mech object created above, $mech->forms is an empty array and hence form methods defined in Mechanize barf on 'undefined value'.

Thanks folks
Sep 16 '08 #1
Share this Question
Share on Google+
1 Reply

Expert 2.5K+
P: 4,059
if you are using WWW::Mechanize, you can't do it, the documentation clearly says it does not support javascript.
Sep 16 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.