XML : Open XML elements in PHP

Good, I created an XML document with the name and title of songs and artists within that document come also the corresponding cover. Now the link of my XML file is: http://inlivefm.96.lt/nw.xml .

I also have another XML document that gives me the name and artist title that this amounts to the moment (ADELE - HELLO) Now the link of my XML file is: http://inlivefm.96.lt/NowOnAir.xml .

Well, what I'm trying to make is that with document I created give me the cover of this song to give right now. I tried to make a code but to no avail in PHP, so I came to ask your help to get success. Here I leave the code I am using to try to get what I want.

  <?php  $xml = simplexml_load_file('http://inlivefm.6te.net/agora.xml');  $artist = urlencode($xml->Event->Song->Artist['name']);  $track = urlencode($xml->Event->Song['title']);  $url = simplexml_load_file("http://inlivefm.96.lt/nw.xml");  $largeImage = $url->xpath('/ilm/$artist- $track/image[@size="cover"]')[0];  echo '<img src="'.$largeImage.'" />';       ?>    

Can you please help me doing this?

Thank you all in advance.

No comments:

Post a Comment