Reading XML file in PHP












XML is Extensible Markup Language used to Exchange Data.
Here is an example of reading XML file in PHP.



ReadXML.php


<?php
echo "Reading XML File<br/>";
$content=simplexml_load_file("msg.xml");


foreach($content as $key=>$value)
 echo "<h4>$key :  $value</h4>";


?>


msg.xml


<?xml version="1.0"?>
  <message>
      <To>Visitors</To>
      <From>http://kbkashid.blogspot.com</From>
      <Subject>Thanks for Visiting!</Subject>
      <Body>Hi! My Blog is entirely dedicated for guys interested in innovative programming and to have fun with it!</Body>
  </message>

No comments:

Post a Comment

Thanks for visiting my Blog!

Have a Question ? Need Help in College Assignments, Need Code that is not available here? Just leave a comment & get your code instantly.

Tips to Enhance Your Blog