I'm trying to send XML to a payment server, in order to keep processing in a central location. Anyway, I'm generating the XML with
XML::Simple and sending with
LWP::UserAgent. The XML looks fine(it is below), but I'm getting the following response
500 - Too many header lines (limit is 128), but I'm not sending any additional headers.
<?xml version="1.0"?>
<PaymentRequest>
<PAY_CC_NUMBER>xxxxxxxxxxxx1234</PAY_CC_NUMBER>
<PAY_OID>Test_ID</PAY_OID>
<PAY_EMAIL></PAY_EMAIL>
<PAY_CC_EXPIRE>1203</PAY_CC_EXPIRE>
<PAY_PROCESSOR>Processor</PAY_PROCESSOR>
<PAY_ZIP>12345</PAY_ZIP>
<PAY_CC_TYPE>Visa</PAY_CC_TYPE>
<PAY_MERCHANT>test2</PAY_MERCHANT>
<PAY_FULL_NAME>Test Customer</PAY_FULL_NAME>
<PAY_AMOUNT>1.00</PAY_AMOUNT>
<PAY_CITY>City</PAY_CITY>
<PAY_ADDR>123 Test st #293 </PAY_ADDR>
<PAY_FUNCTION>Authorize</PAY_FUNCTION>
<PAY_STATE>PA</PAY_STATE>
<PAY_CVV2>111</PAY_CVV2>
<PAY_COUNTRY>US</PAY_COUNTRY>
<PAY_SCRIPT>test.cgi</PAY_SCRIPT>
</PaymentRequest>
Here is the Perl code:
use strict;
use warnings;
use XML::Simple;
use LWP::UserAgent;
my $data = ##XML Data from external source.
my $xml;
eval {
$xml = XMLout($data, rootname => 'PaymentRequest',
xmldecl => '<?xml version="1.0"?>',
noattr => 1);
};
if ($@) {
##Error Handling
}
my $ua = new LWP::UserAgent;
my $req = new HTTP::Request('POST', "http://$server/pay.cgi");
$req->content_type('text/xml');
$res = $ua->simple_request($req);
if (! $res->is_success) {
##Error Handling
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.