How to automatically submit html for data?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
We have an html page at work that we can access to allow
us temporary access through the firewall.  This is fine
from a workstation, but we need to do this on some Unix
servers as well.  Is there any way with perl I could
generate the page below, and perform the submit, using
a perl script?  This particular html page prompts for a
user name, then the next page prompts for the password.


  Authentication Form
<BODY BGCOLOR="#000000" TEXT="#00FF00">

<h3 align=left><font face="arial,helvetica">Client Authentication Remote


<INPUT TYPE="hidden" NAME="ID" VALUE="d50bf20da094c2887356296"> <P>
FireWall-1 message: User: <p> <P>
User name: <INPUT NAME="DATA"> <P>
Press 'Submit' when done: <INPUT TYPE="submit"
VALUE="Submit">. <P>
<p> <P>

Re: How to automatically submit html for data?

Quoted text here. Click to load it

You seem to have an imperfect understanding of the division
of labor between web servers and browsers.

There is no reason to "generate the page below", because that
is merely input to the browser, and (I think) you want to
do it in Perl without a browser.

So, what you really need to be able to do is to generate the
same HTTP request that a browser would generate from that
(filled in) form.

And yes, you can make Perl programs that "look like" browsers.

Did you check the Perl FAQ before posting to the Perl newsgroup?

   perldoc -q html

       How do I fetch an HTML file?

       How do I automate an HTML form submission?

See also:

   Web Scraping Proxy /

    Tad McClellan                          SGML consulting                   Perl programming
    Fort Worth, Texas

Re: How to automatically submit html for data?

On Sun, 25 Dec 2005 07:10:03 -0600, Tad McClellan wrote:

Quoted text here. Click to load it

Another poster suggested WWW::Mechanize and WWW::Mechanize::FormFiller,
which seems to work well as long as there are no SSL certificates
involved.  Unfortunately, the form I'm trying to automatically
submit the data for is an https:// URL, and you are first
presented with an SSL cert.

Site Timeline