phphtmlxmlencodingelgg

POSTing XML via HTML Forms


I am developing a web and want to make it so that the user can create some stuff POSTing XML data. For that purpose there is a <textarea> where the user can write (copy/paste) XML and submit it. The problem is that I am losing data: characters such as <, >, and I think others too, get lost.

Maybe it is a framework problem, not sure, I am using Elgg and receiving the data with get_input().

UPDATE1: some code answering the comment:

<form method="POST" action="http://for.bar/slash" enctype="text/xml">
<input name="add" type="submit" value="Create"  />
</form> 

to receive the data I use elgg get_input()

$data = get_input('data');

Solution

  • If i where to make a wild guess I'd say that there is some kind of auto-magical xss protection being used by get_input(). You could try doing a print_r($_POST); or perhaps elgg is "sanitizing" all of $_POST as well. In this case you may have to base64 encode the data with JavaScript before submitting the request.