Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I want to read "param" and the entry in it.Something like $xml->info->node->param[0]['name']. But it doesn't work like that and i was wondering if anyone know how i should do it.below the php code i'm using and the xml file to read.Code: Select all
<?php
$string = "http://pathto/myxml.xml";
$xml = simplexml_load_file($string);
echo "host:<b>".$xml['host']."</b><br>"; /*<--this work*/
echo $xml['timestamp']."<br>";/*<--this work*/
echo "<hr>";
$xml->info->node->param[0]['name'];/*<--this DOESN"T work or any similar syntax*/
?>Code: Select all
<node-status port="1000" host="MYHOSTNODE" timestamp="TIMEWITHHOUR">
<info>
<node>
<param name="type" value="special"/>
<param name="id" value="25486622225"/>
<param name="version" value="0.225"/>
<param name="up-since" value="sometime"/>
<param name="connections" value="1"/>
<param name="thread-count" value="5"/>
</node>
</info>
</node-status>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]