Posting XML with curl (command line) without using key / value pairs
Consider a PHP script that outputs all data POST
like this:
<?php var_dump($_POST); ?>
The script is in http://example.com/foo.php
.
Now I want to send XML data to it (without using key / value pairs) using the command line curl
. I've tried many options:
curl -H "Content-type: text/xml; charset=utf-8" --data-urlencode "<foo><bar>bazinga</foo></bar>" http://example.com/foo.php
However, none of them seem to post anything - according to the PHP script, $_POST
is just an empty array.
What am I doing wrong here?
+2
a source to share