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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yaFaheem
    New Member
    • Sep 2008
    • 1

    #1

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

    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:

    Code:
    <html>
    <body>
    Enter Hostname:
            <input type="text" name="host_name" id="host_input"/>
            <input type="submit" value="Investigate!" onClick="populate();"/> 
    <br/>
    </body>
    </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?

    Code:
    my $mech=WWW::Mechanize->new(autocheck=>1);
    $mech->cookie_jar($cookie_jar);
    $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
    Last edited by eWish; Sep 16 '08, 10:48 PM. Reason: Please use code tags
  • KevinADC
    Recognized Expert Specialist
    • Jan 2007
    • 4092

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

    Comment

    Working...