This site is mobile accessible. Press the "Tap Here" button to use a different font-size.


Smartphone icons created by Freepik - Flaticon

PHP SimpleXML - Get

Get Node Values

Tove
Jani
Reminder
Don't forget me this weekend!

<?php
// contents of external file (note.xml)
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>

// load external file, extract and display the data
$xml=simplexml_load_file("include/note.xml") or die("Error: Cannot create object");
echo $xml->to . "<br>";
echo $xml->from . "<br>";
echo $xml->heading . "<br>";
echo $xml->body;
?>