Getting WWW::Mechanize to submit a form



Apologies if I upset someone by posting this here. I had no response in comp.lang.perl.misc.

I'm trying to use this module to populate and submit a form on a remote server, but *apparently* it is not doing either.

-------------------------- 8< ---------------------------
#! /usr/bin/perl
use strict;
use warnings;

use lib (
'/home/usr241/cgi-bin/PerlMods/WWW-Mechanize-1.18/lib',
'/home/usr241/cgi-bin/PerlMods/libwww-perl-5.808/lib',
'/home/usr241/cgi-bin/PerlMods/HTML-Parser-3.56/lib/'
);
use WWW::Mechanize;
use HTML::Form;

my $mech = WWW::Mechanize->new();
my $url = "http://xxx.xxx.xxx./form.aspx";; # edited
my $name="form1";

$mech->get( $url );
die "Can't even get the home page: ", $mech->response->status_line
unless $mech->success;

print "Found $url<br>\n" if $mech->success();

$mech->form($name);

die "Can't get the form name: ", $mech->response->status_line
unless $mech->success;

print "Found '$name'<br>\n" if $mech->success();

$mech->field('txtFirstName',$Firstname); # previously defined
$mech->field('txtLastName',$Lastname); # previously defined

print "Populated '$name'<br>\n" if $mech->success();

my $results = $mech->submit();

print "Submitted '$name'<br>\n" if $mech->success();
print "</body></html>\n";

-------------------------- 8< ---------------------------


When the script runs, it prints out everything as if there were no errors. But the programmer running the form at the remote site is saying nothing is coming through. I've tested a similar script myself, taking form data from a static HTML form, and posting it to another static HTML form on a different server, and it works fine.

Can anyone see anything wrong with this code that would cause it to fail? The form I'm trying to populate and submit is a .aspx document.

--
Amer Neely
w: www.webmechanic.softouch.on.ca/
Perl | MySQL programming for all data entry forms.
"Others make web sites. We make web sites work!"
.



Relevant Pages

  • RE: Messed up RemoteMail (SBS2003)
    ... Thank you for posting to the SBS Newsgroup. ... I understand that you have made some changes on Web Sites in IIS. ... This posting is provided "AS IS" with no warranties, ...
    (microsoft.public.windows.server.sbs)
  • Re: how can i install ie6 without internet connection
    ... "Richard Lawrence" wrote in message ... >> There is absolutely nothing wrong with top posting here. ... > 7,320,000 web sites would disagree with you. ...
    (microsoft.public.windowsxp.general)
  • Re: Diabetes, Cholesterol & Heart Disease
    ... low carb web sites and visit the diabetic and kidney web sites. ... rarely posting affirmatively in general. ... President, or that we are to stand by the President ...
    (alt.support.diabetes)
  • "Fishing"? (was: Re: Correspondence Based Books/Movies)
    ... Miz Ultraviolet wrote: ... "Speaking of business failures, Haddad, I thought it would ... you believe that posting those two URLs ... to two of my many web sites is going to scare me. ...
    (misc.writing)
  • Re: populate treeview from single table parent-child relationship
    ... Thanks, Frans, I was surprised to see my post in here as I did not think it ... got posted (I waited a whole day before posting again) and now I've actually ... I've been looking around with little luck on how to populate ... I'm unsure of how to do ...
    (microsoft.public.dotnet.framework.adonet)