PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Artists

Zend_Service_Audioscrobbler provides several methods for retrieving data about a specific artist, specified via the setArtist() method:

  • artistGetRelatedArtists(): Returns a SimpleXML object containing a list of Artists similar to the current Artist.

  • artistGetTopFans(): Returns a SimpleXML object containing a list of Users who listen most to the current Artist.

  • artistGetTopTracks(): Returns a SimpleXML object containing a list of the current Artist's top-rated Tracks.

  • artistGetTopAlbums(): Returns a SimpleXML object containing a list of the current Artist's top-rated Albums.

  • artistGetTopTags(): Returns a SimpleXML object containing a list of the Tags most frequently applied to current Artist.

Example 785. Retrieving Related Artists

<?php
$as 
= new Zend_Service_Audioscrobbler();
// Set the artist for whom you would like to retrieve related artists
$as->setArtist('LCD Soundsystem');
// Retrieve the related artists
$relatedArtists $as->artistGetRelatedArtists();
foreach (
$relatedArtists as $artist) {
    
// Display the related artists
    
print '<a href="' $artist->url '">' $artist->name '</a><br />';
}

Zend Framework