Creating a PHP page that shows an image via last.fm API



I'm trying to do a PHP page to shows an album cover via Last.FM API. However, the Artist Name and the Title of the music are provided by a XML file that a software updates via FTP.


Here is the code of Last.FM api:



<?php
$img = simplexml_load_file('http://ift.tt/1ApBKJM');
echo '<img src="';
echo $img->track[0]->album[0]->image[3];
echo '">';
?>


Now the link of my XML file is: http://ift.tt/X3Qwqv The info I need to the Last.FM API is in 'OnAir/CurMusic'.


Well, what I am trying to do is change "Cher" and "Believe" (the artist's name and the Title's name) in the link of the "simplexml_load_file" (in the php code) with the info that my XML file provides.


Can you please help me doing this?


Thank you all in advance.


No comments:

Post a Comment