I have the following script that recieves an xml file and reads it with file_get_contents(). I want to redirect this xml to a file called “register” but it doesn’t work and I have no idea why.
<?php
$xml_post=file_get_contents('php://input');
$xml=simplexml_load_string($xml_post);
if($xml->action=='register')
{
header('Location: http://proiectis.host22.com/register.php');
exit;
}
?>
I would appreciate your help.
This is my xml:
<xml version="1.0">
<action>register</action>
<parameters>
<name>Ionel Popescu</name>
<username>Ionel P</username>
<email>ionel@popescu.com</email>
<password>abdef01</password>
</parameters>
</xml>
I think there is a misunderstanding in the XML document.
You have no XML header in your document but you use the
<xml>-element as the root element.Try this instead:
The original PHP code should work now.