i have this string in php, this string i think is already well formatted like an xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Books>
<ID>1</ID>
<Title>Programming 1</Title>
<ISBN>1234567890001</ISBN>
<Author>Kevin</Author>
<Abstract>This Book is about programming</Abstract>
</Books>
So i convert this string into xml using simplexml_load_string() function, but the thing is it never resulted back as an xml so every time i do the print_r(), i will got like this:
SimpleXMLElement Object ( )
i think it should be contain all the tree and nodes as usual, but the object returned is always null. i already tried several other method. But all of them will give the same result which is blank XML object.
So is there something wrong with my string format? or maybe there's something wrong with my code. here is my code:
<?php
$ISBN=$_POST["ISBN"];
$url='http://localhost:8080/Programming/services/hello_world/DatabaseSearch?ISBN='.$ISBN;
$xmlstr = file_get_contents($url);
echo $xmlstr;
$xml=simplexml_load_string($xmlstr);
echo $xml->Books->Title;
print_r($xml);
?>
the
echo $xml->Books->Title;
return only null value. So i don't know what's actually wrong, i already trying to fix this for days now but no result. Please help me..