Getting XML Data From A Looped Link?

Hi All,

I have a site that I need to extract some XML data from an API. I have bands listed using a loop from a DB. I use this looped band variable inside of the API URL to get the XML data.

Here is the code I have now:
[php]
while($qresults=mysql_fetch_array($query)){
$id=$qresults[‘id’];
$date=$qresults[‘date’];
$artist=$qresults[‘artist’];
$title=$qresults[‘title’];
$label=$qresults[‘label’];
$dist=$qresults[‘dist’];
$format=$qresults[‘format’];
$genre=$qresults[‘genre’];
$upc=$qresults[‘upc’];
// First, get the artist from the loop
$songkick_artist = str_replace(’ ', ‘+’, $artist);

$songkickLink = “<a id=“songkick” target=”_blank" class=“tipsheet” href=“http://api.songkick.com/api/3.0/search/artists.xml?query=$songkick_artist&apikey=qeQKBP7qyvJ9tru5”><img src=“images/skLogoBlack.jpg” height=“25” border=“0”>";

print "


<td valign=“middle” width=“10%” class=“tdborder” align=“center”>$date
<td valign=“middle” width=“20%” class=“tdborder”><a href=“http://www.google.com/search?hl=en&q=$artist” target="_blank" class=“tipsheet”>$artist
<td valign=“middle” width=“10%” class=“tdborder” align=“center”>$amazon_search
<td valign=“middle” width=“10%” class=“tdborder”>$songkickLink


[/php]

From here I can get all the XML for each band but I don’t know how to extract it and get what I need from it. I have read every tutorial and it seems there are 100 ways to do the same thing. I am hoping to find the best possible solution.

Appreciate any help on this…

Not sure I understood your question… But if you need to parse XML to extract data, here is simplexml example.

Sponsor our Newsletter | Privacy Policy | Terms of Service