Solved

Howto: automated data submission to a form page

Posted on 2004-03-23
5
301 Views
Last Modified: 2013-12-25
Is there a programming method I can use to go to a form page on the web (via a Perl script), enter some value like a zip code into a form field on that page (again via the script that is picking the inputs out of a text file, say), then when the result page is returned, retrieve it and parse it for data?  I know Perl and C, so the problem areas for me are (a) automatically submitting a piece of information to the form page (like zip code), and (b) retrieving the html of the result page so I can scrape it.  Thanks, hope that's clear.
0
Comment
Question by:mark_at_acc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 3

Assisted Solution

by:rkosai
rkosai earned 250 total points
ID: 10663442
You would probably want to use the Perl LWP::Simple module.

Assuming the form uses a GET request (the results page has page.cgi?formvalue=data, or something like that), you can simply retrieve the page using the LWP module.  Example code is below:

#!/usr/bin/perl
use LWP::Simple;
my $html = get("http://website/page.cgi?zipcode=12345"); #download the site

#$html now contains the HTML code for the page.  You can use a regular expression to parse it.
0
 
LVL 48

Accepted Solution

by:
Tintin earned 250 total points
ID: 10663698
0
 

Author Comment

by:mark_at_acc
ID: 10663941
Both of you helped me, thanks a lot.  The page I care about today uses POST, so Tintin's Perl reference is actually more helpful, but rkosai's solution is clear, and can be helpful in the future.  I will be doing more of this type of web programming soon. Thanks a lot.

I am brand new to experts-exchange, and I CANNOT bookmark my questions!!  When I click "bookmark" at top left, I get nothing, with a note telling me how to click "add", etc, which I have done over and over.  I submitted the prob. to the EE bug page, but got no response yet.

Thanks again.
0
 
LVL 48

Expert Comment

by:Tintin
ID: 10664106
As you'll soon discover the LWP bundle is great for doing all sorts of web type activities.  

Don't forget to read through the LWP tutorial

http://search.cpan.org/dist/libwww-perl/lwptut.pod

Not sure why you are having a problem with the bookmarks.  What browser are you using?
0
 

Author Comment

by:mark_at_acc
ID: 10664375
I figured it out -- appears to be user error. thanks anyhow.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial will discuss fancy secure registration forms, with AJAX technology support. In this article I assume you already know HTML and some JS. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you mig…
In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question