use strict;
use Data::Dumper;
use LWP::UserAgent;
use HTTP::Request;
use Net::SSLeay qw(get_https post_https sslcat make_headers make_form);
my $method = 'POST';
my $host = 'orbital1.paymentech.net';
my $uri = '/authorize';
## This is the fake request we are generating
my $xmlRequest = ''.
''.
'A'.
'000002'.
'001'.
'33333'.
''.
'';
my ($page, $response, %reply_headers);
my $MIME_Version = '1.0';
my $content_type = 'application/PTI42';
my $content_length = length $xmlRequest;
my $content_transfer_encoding = 'text';
my $request_number = '1';
my $document_type = 'Request';
my $headers = make_headers(
'MIME-Version' => $MIME_Version,
'Content-Type' => $content_type,
'Content-length' => $content_length,
'Content-transfer-encoding' => $content_transfer_encoding,
'Request-number' => $request_number,
'Document-type' => $document_type,
);
($page, $response, %reply_headers) = post_https(
$host,
443,
$uri,
$headers,
$xmlRequest,
);
print STDERR "\n========= page ======== \n" . Dumper($page);
print STDERR "\n========= response ======== \n" . Dumper($response);
print STDERR "\n========= reply_headers ======== \n" . Dumper(%reply_headers);
__END__
OUTPUT FOR ABOVE REQUEST IS =====> :
========= page ========
$VAR1 = '
413 Request Entity Too Large
Request Entity Too Large
The requested resource
/authorize
does not allow request data with POST requests,
or the amount of data provided in
the request exceeds the capacity limit.
Additionally, a 413 Request Entity Too Large
error was encountered while trying to use an ErrorDocument to handle the request.
';
========= response ========
$VAR1 = 'HTTP/1.1 413 Request Entity Too Large';
========= reply_headers ========
$VAR1 = 'CONTENT-TYPE';
$VAR2 = 'text/html; charset=iso-8859-1';
$VAR3 = 'DATE';
$VAR4 = 'Mon, 27 Aug 2007 06:11:29 GMT';
$VAR5 = 'CONNECTION';
$VAR6 = 'close';