Band:
Show query & reponse? >
"/music/artist", // We want an musical artist //WILL: many bands have multiple entries, example 'the beatles' "name" => $band, // This is its name "album" => array())); // Fill in this empty albums array! // Insert your own freebase.com cookie data into the string below // ### Put your cookie data here ### $credentials = 'metaweb-user="Z|a_aaaaaaaaaa|a_#1111a1a11111111a1111111111aa1111|1.aaZZZaZaZaaZZaZZ1aZ/ZZ"'; //WILL: show format of cookie // Submit the query using the utility function defined earlier $result = $metaweb->read($query, $credentials); $bandCount = count($result); //WILL: support multiple matches on a band name if ($bandCount>1) { print "

$bandCount bands match '$band'. Just showing results from the first band

";} // This is the array of albums we want $albums = $result[0]["album"]; if ( ! count($albums) ) { print "

No albums found for '$band'

"; //WILL: basic error checking required to avoid PHP errors } else { // Display the albums on the web page echo "

Albums by " . $band . "

"; foreach ($albums as $album) echo $album . "
"; } } ?>