Search the Community
Showing results for tags 'xmlapi'.
-
Not sure if I am putting this in the right thread. I am new to xml and working with api's. I am working on a songkick api script. All of it is working correctly except I can't get the id. I have tried multiple things and none of them worked sadly. $artist_id = $_GET['id']; $api_key = "##########################"; $request_url = "http://api.songkick.com/api/3.0/artists/" . $artist_id . "/calendar.xml?apikey=" . $api_key; $xml = simplexml_load_file($request_url); foreach ($xml->results->event as $event) { $skdate = $event->start["date"]; $date = date("M d, Y", strtotime($skdate)); $id = $event->id; //what I can't get working $venue = $event->venue["displayName"]; $city = $event->location["city"]; $street = $event->location["street"]; $zipcode = $event->location["zipcode"]; $phone = $event->location["phone"]; $website = $event->location["website"]; $capacity = $event->location["capacity"]; $description = $event->location["description"]; $artists = $event->xpath("./performance/artist/@displayName"); echo "<a href=\"details.php?id=$id\" class=\"show_events\"> <span id=\"date\">$date</span> <span id=\"header\">$venue</span> $city<br>"; echo implode(', ',$artists); echo "</a>"; } Songkick API repsonse: { "resultsPage": { "results": { "event": [ { "id":11129128, "type":"Concert", "uri":"http://www.songkick.com/concerts/11129128-wild-flag-at-fillmore?utm_source=PARTNER_ID&utm_medium=partner", "displayName":"Wild Flag at The Fillmore (April 18, 2012)", "start":{"time":"20:00:00", "date":"2012-04-18", "datetime":"2012-04-18T20:00:00-0800"}, "performance":[{"artist":{"uri":"http://www.songkick.com/artists/29835-wild-flag?utm_source=PARTNER_ID&utm_medium=partner", "displayName":"Wild Flag","id":29835,"identifier":[]}, "displayName":"Wild Flag", "billingIndex":1, "id":21579303, "billing":"headline"}], "location":{"city":"San Francisco, CA, US","lng":-122.4332937,"lat":37.7842398}, "venue":{"id":6239, "displayName":"The Fillmore", "uri":"http://www.songkick.com/venues/6239-fillmore?utm_source=PARTNER_ID&utm_medium=partner", "lng":-122.4332937, "lat":37.7842398, "metroArea":{"uri":"http://www.songkick.com/metro_areas/26330-us-sf-bay-area?utm_source=PARTNER_ID&utm_medium=partner", "displayName":"SF Bay Area","country":{"displayName":"US"},"id":26330,"state":{"displayName":"CA"}}}, "status":"ok", "popularity":0.012763 }, .... ]}, "totalEntries":24, "perPage":50, "page":1, "status":"ok" } } I would just like to know how to get the id working - it is just left blank.