Have quite a strange thing occuring...
Am posting xml to a parsing script. The script outputs an array as a result, using the function xml_parse_into_struct. When the xml is read from a file, or as GET from a form it works fine, but when POSTed, it falls over on the first line -> <?xml version="1.0" encoding="ISO-8859-1"?>. It seems to have exceptions with whitespace and non (0-9 a-z) characters as for example <xml> will work.
Here's the code...
<?php
if(!$POST['sent']) {
?>
<form name="form1" method="post" action="<?php $SERVER['PHP_SELF']; ?>">
<textarea name="data" cols="90" rows="26"></textarea>
<input type="submit" name="Submit" value="Submit">
<input type="hidden" name="sent" value="1">
</form>
<?php
}
if($POST['sent']) {
$sample = $POST['data'];
function parse($input) {
$p = xml_parser_create();
xml_parse_into_struct($p,$input,$vals,$index);
xml_parser_free($p);
echo"<pre>";
print_r($vals);
echo"</pre>";
}
parse($sample);
}
?>