Connecting Tech Pros Worldwide Forums | Help | Site Map

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

Newbie
 
Join Date: Sep 2008
Posts: 1
#1: Sep 16 '08
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

KevinADC's Avatar
Expert
 
Join Date: Jan 2007
Location: Southern California USA
Posts: 4,091
#2: Sep 17 '08

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


if you are using WWW::Mechanize, you can't do it, the documentation clearly says it does not support javascript.
Reply