Last.fm event venues query

333 views Asked by At

I'm currently building an application to return gigs in the selected city, e.g. Edinburgh using the last.fm geo.getEvents API.

It's going well, but I'd like to categorise each gig under its respective gig venue. e.g.

VENUE 1: eventname1, eventname2
VENUE 2: eventname5, eventname7

etc.

I tried coding a nested loop grab the venues then the associated gigs, but I failed with that. Here is the XML (sample) I'll be working with from last.fm.

<events location="New York" page="1" totalpages="105" total="1050">
<event>
  <id>640418</id>
  <title>Nikka Costa</title>
  <artists>
    <artist>Nikka Costa</artist>
    <headliner>Nikka Costa</headliner>
  </artists>
  <venue>
    <name>Bowery Ballroom</name>

It appears that the nested loop didn't work as the gig/artist name is not below the 'venue' tag in the hierarchy.

Any ideas of how to do this? Thanks.

1

There are 1 answers

0
Kyle On BEST ANSWER

You might have to manually do this if the API does not allow for results to be returned by venue. You could create a multi-dimensional array.

$events['Bowery Ballroom'][640418];

It could be indexed by venue and then by event. You could add to the array as follows:

$events['venue_name'][] = 1234; // where 1234 is the event ID