I have an XML document being sent to me by HTTP POST:
<?xml version="1.0" encoding="UTF-8" ?>
<DeliveryNotification eventType="newMessage">
<requestUid>sms9676187</requestUid>
<sentMessageUid>sms29282896</sentMessageUid>
....
</DeliveryNotification>
Which I then receieve in a perl script using the param() subroutine:
#!/usr/bin/perl -w
use strict;
use CGI qw/param/;
use Data::Dumper;
my @xml = param();
warn Dumper(@xml);
and when I Dumper the result I get:
$VAR1 = '<?xml version';
It seems to break the file whenever it runs into an ‘=’ sign. If I remove the first eqauls sign to test, it just breaks at the next one. Can this only be solved from the side that is sending the data by escaping the equals or can I do something in Perl?
I take it your script looks something like:
param()expects a url-encoded list of parameters in the query string (GET or POST), and in list context returns the names of the parameters.If you just want the raw data from the query string (and never expect to handle form data), use
query_string()and submit the XML via a GET request instead.You can read the raw POST data via STDIN without using CGI, but there are caveats.