I must be missing something simple here and it's driving me crazy.
I'm making a call to a web services api and getting back some xml:
<?xml version="1.0" encoding="utf-16"?>
<MTSMember xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<LastName>Smith</LastName>
<FirstName>john</FirstName>
<MemberNo>xxxxxxxx</MemberNo>
<Club>None</Club>
<JoinDate>2013-05-14</JoinDate>
<Email>[email protected]</Email>
</MTSMember>
I then need to process this xml to get the email address. but I'm just getting an empty result using the code below:
$xml_result = simplexml_load_string($xml_string_above);
echo $xml_result->MTSMember[0]->Email;
Can someone point me in the right direction. I've read through several other answers trying out various solutions, but can't seem to get it to work.
Edit: This was the last tutorial i tried out http://blog.teamtreehouse.com/how-to-parse-xml-with-php5