I'm trying to create an XML object via an xml string passed from unity to a url (eg. gamedata.php).
Method : POST
Now this is what happens.
via web browser : If i pass the string via the web browser (by changing the method to _REQUEST in php) it successfully creates the xml object and executes all the required scripts & queries.
via the build (unity) : When the same xml string is passed through the game, it throws an error Call to a member function asXML() on string in /var/www/html/
Below is the code
$myXMLData = trim($_POST['xml']);
$xml=simplexml_load_string($myXMLData) or die("Error: Cannot create object");
$xml->asXML();
So Unity's debug console receives Error : Cannot create object & the log throws the error mentioned above.
XML passed
<?xml version="1.0" encoding="UTF-8" standalone="no"?><root><player id="3" avatar="m"><scenarios><scenario id="1" attempts="12" score="14" completed="" time=""><badges><badge id="1" icon="badges-icon"><title>Badge Title 01</title><description>Badge Text 01</description></badge><badge id="2" icon="badges-icon"><title>Badge Title 02</title><description>Badge Text 02</description></badge></badges><warnings><warning id="7" icon="badges-icon"><title>Warning Title 01</title><description>Warning Text 01</description></warning></warnings></scenario><scenario id="2" attempts="8" score="120" completed="" time=""><badges><badge id="6" icon="badges-icon"><title>Badge Title 09</title><description>Badge Text 09</description></badge></badges><warnings><warning id="8" icon="badges-icon"><title>Warning Title 03</title><description>Warning Text 03</description></warning></warnings></scenario></scenarios></player></root>
Can anyone help me out with this?