/** * * @param <type> $pString * @return <type> */ public static function find_artist($pString) { $client = new Zend_Rest_Client("http://musicbrainz.org/ws/1/artist/"); $client->type('xml'); $client->name(str_replace(' ', '+', $pString)); return $client->get(); }
/** * * @param <type> $pSearch_string * @return <type> */ public static function search($pSearch_string) { $client = new Zend_Rest_Client("http://musicbrainz.org/ws/1/artist/"); $client->type('xml'); $client->name(str_replace(' ', '+', $pSearch_string)); $result = $client->get(); $out = array(); foreach ($result as $list) { foreach ($list->children() as $node_name => $node) { if ($node_name == 'artist') { $artist = new stdClass(); $attrs = $node->attributes(); $artist->mbid = (string) $attrs['id']; $artist->type = (string) $attrs['type']; $artist->name = (string) $node->name; $artist->disambiguation = (string) $node->disambiguation; $out[$artist->mbid] = $artist; } } } return $out; }