Andy Cruz
Andy Cruz

Reputation: 87

XML document opens with the function echo

I come again to ask you help, I wanted to know what is the mistake I am making. I liked that with the echo function to be able to have access to Artist, Song and JazlerID. I leave here the xml document link that holds the information http://inlivefm.6te.net/AirPlayNext.xml.

<?xml version="1.0" encoding="utf-8"?>
 <Event status="coming up">
  <Song title="IN THE MORNING LIGHT">
   <Artist name="ALEX SCHULZ" > 
   </Artist>
    <Info StartTime="21:55:08" JazlerID="7"  />
  </Song>

 </Event>

this is the code I'm using to find out JazlerID

<?php
$xml = simplexml_load_file("http://inlivefm.6te.net/AirPlayNext.xml");
print $xml>Event->Jazler['ID'];
?>

Other place thanks for availability and am awaiting some respost

Upvotes: 1

Views: 109

Answers (1)

Phil
Phil

Reputation: 164913

The SimpleXMLElement returned by simplexml_load_file() is the root element (so <Event> in this case). You also access attributes (such as JazlerID) like array elements so what you want is

echo $xml->Song->Info['JazlerID'];

Upvotes: 2

Related Questions