开发者

Last.fm event venues query

开发者 https://www.devze.com 2023-02-08 17:34 出处:网络
I\'m currently building an application to return gigs in the selected city, e.g. Edinburgh using the last.fm geo.getEvents API.

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" totalpage开发者_开发百科s="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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消