PHP – Simple XML GET

XML stands for EXtensible Markup Language.It is a markup language much like HTML which was designed to store and transport data and was designed to be self-descriptive.It plays an important role in many IT systems like creating web services.That’s why it is important for any software developer to have a sound knowledge of XML.

How to get the node values by using PHP :
<?xml version=”1.0″ encoding=”utf-8″?>
<SynapseIndia>

<technology category=”PHP”>
<title lang=”en”>PHP</title>
<developer>Gopal</developer>
<price>$30</price>
</technology>

<technology category=”Android”>
<title lang=”en”>Android</title>
<developer>Ramesh</developer>
<price>$50</price>
</technology>

<technology category=”Asp”>
<title lang=”en”>Asp</title>
<developer>suresh</developer>
<price>$60</price>
</technology>
</SynapseIndia>

<html>
<body>

<?php
$xml=simplexml_load_file(“xmlfilename.xml”) or die(“Error: Cannot create object”);
foreach($xml->children() as $project) {
echo $project->title . “<br> “;
echo $project->developer . “<br> “;

echo $project->price . “<hr/>”;
}
?>

</body>
</html>

SynapseIndia is a leading website and mobile app development company having no complain. IT Mentor & an Entrepreneur SynapseIndia CEO Shamit Khemka spread their business across the globe. They have more than 300 full time professionals and all the experts at SynapseIndia working in tandem to achieve good feedback from clients. They have already delivered more than 3000 thousand projects and SynapseIndia has achieved best reviews . They pass on complete quality solutions for website development services and getting good feedback on various SynapseIndia PHP Web development projects.

Please visit www.synapseindia.careers for more details

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>