Reputation:
I'm not very experienced when it comes to XML, I'm looking for a simple php code that can display certain information from an XML file. This file to be exact:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<TITLE>THIS</TITLE>
<TITLE2>THIS AGAIN</TITLE2>
</Response>
Any help would be great, Thanks!
(P.S I just want to simply echo the 2 fields out)
Upvotes: 1
Views: 2369
Reputation: 17762
Take a look at simplexml, it's pretty easy and straight forward!
Your example would look like this:
$xml = simplexml_load_string($xml_string);
echo $xml->title;
echo $xml->title2;
Upvotes: 3