slyio76
11-30-2005, 05:54 AM
Hi,
I'm new to Perl and I'm trying to send some data from perl to a PHP file using the post method.
First, I submit a form (register.php) to perl (register.pl) using POST method.
After checking the database, if there is duplicate record, the register.pl should forward whatever data entered in the register.php together with the error code back to register.php using the POST method.
I tried using the following code I found in some example, but it always gave timeout error. Please kindly advise. Thank you!
use strict;
use warnings;
use LWP 5.64;
my $browser = LWP::UserAgent->new;
my $url = 'http://localhost/register.php';
my $response = $browser->post( $url,
[ 'emailAddress' => $emailAddress,
'fromPage' => $fromPage, 'customerName' => $customerName, 'address1' => $address1,
]
);
die "$url error: ", $response->status_line
unless $response->is_success;
die "Weird content type at $url -- ", $response->content_type
unless $response->content_type eq 'text/html';
I'm new to Perl and I'm trying to send some data from perl to a PHP file using the post method.
First, I submit a form (register.php) to perl (register.pl) using POST method.
After checking the database, if there is duplicate record, the register.pl should forward whatever data entered in the register.php together with the error code back to register.php using the POST method.
I tried using the following code I found in some example, but it always gave timeout error. Please kindly advise. Thank you!
use strict;
use warnings;
use LWP 5.64;
my $browser = LWP::UserAgent->new;
my $url = 'http://localhost/register.php';
my $response = $browser->post( $url,
[ 'emailAddress' => $emailAddress,
'fromPage' => $fromPage, 'customerName' => $customerName, 'address1' => $address1,
]
);
die "$url error: ", $response->status_line
unless $response->is_success;
die "Weird content type at $url -- ", $response->content_type
unless $response->content_type eq 'text/html';