I have the following Simple XML Data:
[Listeners] => 37
[listener] => Array
(
[0] => SimpleXMLElement Object
(
[IP] => 0.0.0.1
[UserAgent] => curl/7.19.7 (i386-redhat-linux-gnu) libcurl/7.19.7 NSS/3.16.2.3 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
[Connected] => 1236
[ID] => 120
)
[1] => SimpleXMLElement Object
(
[IP] => 0.0.0.2
[UserAgent] => curl/7.19.7 (i386-redhat-linux-gnu) libcurl/7.19.7 NSS/3.16.2.3 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
[Connected] => 1235
[ID] => 121
)
I want to show [IP].
So I have this PHP script:
<?php
$url = "http://admin:[email protected]/admin/listclients?mount=/FavoriteFM";
$xml = simplexml_load_file($url);
echo "<pre>";
print_r($xml);
$IP = $xml->listener->IP;
echo $IP[0];
?>
But it's not working. How can I display display IP in the proper way?