Select and echo a random entry from an XML file in php
I am new to XML, please help. I have a small xml file like this...
<?xml version="1.0" encoding="utf-8"?>
<VISITOR>
<VID="1">
<NAME>Irena Lyns</NAME>
<FROM>Shenfield</FROM>
<COMMENT>I'm so glad I came.Everything is so beautiful.</COMMENT>
</VID>
<VID="2">
<NAME>Gabriella</NAME>
<FROM>ITALIA</FROM>
<COMMENT>Wonderful!!! </COMMENT>
</VID>
<开发者_如何学JAVA/VISITOR>
What is the code I would need to display a random VID, NAME, FROM and COMMENT on my php page?
Thank you in advance!!! :)
parse it with SimpleXML and chose random record from result - look at examples
精彩评论