CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
POSTing with LWP



Apr 3, 2000, 1:48 PM

Post #1 of 1 (1971 views)
POSTing with LWP Can't Post

Firstly, thanks for all previous help (thanks japhy) Smile

Now then...I am attempting to write a program that sends data to a perl script on the web via the POST method and reads the resulting HTML file, but I am having trouble doing so.

I shall illustrate my problem using the page at simply because it is a script which uses the POST method (and which I can' manage to access with a script).

The form at this page has the HTML:

<FORM action="" method=POST>

<td><input name="Name" size=60></td>
<td><input name="Password" type="password" size=60></td>

<input type="reset" value="Reset fields to old values"><br>
<input type="submit" value="Click Here to Send to Server"><br>

I have the following script, which as far as I can see should print the HTML of the resulting page, however I instead receive an error, what can be wrong?

use LWP::UserAgent;
$ua = new LWP::UserAgent;
$ua->agent("MyAgent/0.1 " . $ua->agent);

my $req = new HTTP::Request POST => '';

my $res = $ua->request($req);

if ($res->is_success) {
print $res->content;
} else {
print "There was an error";

What am I doing wrong that the error is always displayed?

Any thanks shall be much appreciated Smile


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives