not logged in • loginregister

Forums


Forums Index » Computers » PHP » [PHP5] Get data from XML files

[PHP5] Get data from XML files


Go to Page: 1


 
August 10th, 2005 15:45
#1

robert_ak


robert_ak's avatar








Super Administrator

Registered: 20/07/05 @ 17:00
Posts: 2168


This is a simple script that uses PHP 5 and SimpleXML to get the values of an xml file.

In a .xml file:
<?xml version="1.0"?>
<computer>
<memory>3GB</memory>
<processor>Intel Pentium 7</processor>
<os>NoName OS</os>
</computer>


In a .php file:

<?php
$xmlfile = "db.xml";

$database = simplexml_load_file($xmlfile) or die ("An error has occured while opening the file.&quot;

// get the data
echo "Memory: ".$database->memory."n";
echo "Processor: ".$database->processor."n";
echo "OS: ".$database->os."n";
?>

______________________
hai
Back to top


Go to Page: 1



Forums Index » Computers » PHP » [PHP5] Get data from XML files

Jump to:   

Who's Browsing This Topic?

1 guest.


Move to: