473,394 Members | 1,709 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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:

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
1 2503
KevinADC
4,059 Expert 2GB
if you are using WWW::Mechanize, you can't do it, the documentation clearly says it does not support javascript.
Sep 16 '08 #2

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

Similar topics

0
by: Antwerp | last post by:
Hi, I'm trying to create a perl script that will log into a website (the login form uses POST), navigate to several pages, and append the (html) content parsed from those pages to a seperate log...
1
by: coder57 | last post by:
Basically I have a local html file, called file1.html it has a series of links (with a particular domain name) in addition to the html code, I am trying to follow each of these links (based on the...
2
by: barrybevel | last post by:
Hi, I have a very small simple program below which does the following: 1) post a username & password to a website - THIS WORKS 2) follow a link - THIS WORKS 3) update values of 2 fields and...
21
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
1
by: Edward Drake | last post by:
I'm trying to interact with a web page that uses JavaScript to add fields to a form if certain things are selected in the first field. I've tried doing something like this... ...
1
numberwhun
by: numberwhun | last post by:
I am having an issue with understanding something in the WWW::Mechanize module. I have a website which I want to download a whole plethora of pdf files from. It is a site that I have paid to access...
1
by: gunabalans | last post by:
#!/usr/bin/perl -w use strict; use LWP; my $ua = new LWP::UserAgent; $ua->agent("Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.8)"); my $request = new HTTP::Request("GET",...
1
by: mithunmo | last post by:
If I run the below program . I get the following error message Can't call method "value" on an undefined value at C:/Perl/site/lib/Win32/IE/Mec hanize.pm line 900. Please let me know your...
2
by: mithunmo | last post by:
I am trying to automate the process of filling up the webforms and do a submit . I have the below program written but If I run the program . I get the following error message Can't call method...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.