View Full Version : Perl Form Submission and Capture Results Locally
microtech
07-18-2005, 08:24 PM
Question for the Perl/CGI Guru's
I’ve built a site out of Perl which stores all data submitted to get a credit report inquiry to a MySQL database. Now I’m trying to capture the page displayed (actual credit report) on the remote site we process to.
On our site we:
1) Fill out form
2) Verify information
3) Process / post verified information remote server to view credit bureau report
Is it possible to capture the remote page with any Perl code or loaded modules? I’m willing to pay for a real solid answer.
4) ????
Kevin
07-18-2005, 08:30 PM
You could just generate the same form and "stuff" the fields with value="whatever is in the database".
microtech
07-18-2005, 08:39 PM
We can only store in the database what is filled out on our site. Once the form posts to the other company’s website we have no way of getting the data from there. We need the page being displayed on the remote site as a result of the submission from our site, this is the target of what we need to capture.
Kevin
07-18-2005, 08:52 PM
Ooops, I missed the remote site part of the question :\
Maybe someone that is better with forms can suggest something better but the best thing I can think of is to have the user submit the form to you instead of the remote site and then you submit the remote form from within your script. That way you can send them the results and keep a copy for yourself.
Kevin's suggestion is the only way to control a 'foriegn' form. You must capture all of the information and then 'submit' the foriegn form by having your code emulate a browser-client by using either the LWP libraries or the openssl libraries.
Note that this approach will only work with a one-page form on the foriegn site. If they have a multi-page form, then you are out of luck. Of course, you will need to seek the permission of the 'foriegn' site before you do what you are planning, otherwise there might be some legal ramifications to 'hijacking' someone else's form submission.
I’ve built a site out of Perl which stores all data submitted to get a credit report inquiry to a MySQL database.
You should realize that if you are storing any personally identifiable information, then you are assuming HUGE liability risks. If any of the information you are storing is used at any point in time to facillitate a credit card transaction, then you are in violation of credit card association rules and can be liable for fines up to $500,000. I would also expect legislation soon enforcing something similar even if the data is not charge-related.
microtech
07-20-2005, 12:27 AM
I'm working on a gig for a big investigation firm to fulfill a contact building the environment. Those detail have wasted space on this post :-) I was looking for technical assistance not legal advice.
I GOT IT and will share for others:
#!/usr/bin/perl
# make sure that these modules are installed
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
use LWP::Protocol::https;
# Set up variables here
# Create the request
$ua = LWP::UserAgent->new();
my $req = POST "https://www.blahblah.com/cgi/credit",
[ TITLE => $title,
FULLNAME => $name,
PASSWORD => $passwd ];
$content = $ua->request($req)->as_string;
@c = split /\n/, $content;
# at this point, "c" holds the HTTP page we return
# and you can print out "c" back to the user
# or store it to disk if you want
exit;
use the perldoc command to verify install mods..
perldoc Net::SSL
perl -MCPAN -e"install LWP::UserAgent"
perl -MCPAN -e"install LWP::Protocol::https"
perl -MCPAN -e"HTTP::Request::Common"
perl -MCPAN -e"install Net::SSL"
perl -MCPAN -e"install Net::SSLeay"
vBulletin® v3.6.8, Copyright ©2000-2009, Jelsoft Enterprises Ltd.