Skip to content

Instantly share code, notes, and snippets.

@giltotherescue
Created May 24, 2012 19:07
Show Gist options
  • Save giltotherescue/2783586 to your computer and use it in GitHub Desktop.
Save giltotherescue/2783586 to your computer and use it in GitHub Desktop.
<?
$url .= '{ "id": "' . $mid . '", "/music/album/artist": [{"mid" : [],"name" : null}], "/music/album/genre": [{}], "/music/album/release_date": null }';
if ($res = ApplicationHelper::rest(array('url' => $url))) {
if ($res->result) {
$body = json_decode($res->body);
$item = (array) $body->result;
foreach ($item['/music/album/artist'] as $p) {
$poss[] = array('type' => 'Artist', 'mid' => $p->mid[0], 'name' => $p->name);
}
foreach ($item['/music/album/genre'] as $a) {
$adj[] = array('type' => 'Genre', 'mid' => $a->id, 'name' => $a->name);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment