get top artists

This gets the xml for the users top artists.

$key='key';
$secret='secret';
$music_token='token';
	
$topartists_url='http:ws.audioscrobbler.com2.0?method=user.gettopartists&user={username}&limit=5&api_key=' . $key;
$top_artists = simplexml_load_file($topartists_url);

foreach ($top_artists->topartists->artist as $artist) {
	$rank = $artist->attributes()->rank;
	$name=$artist->name;
	$playcount=$artist->playcount;
	$url=$artist->url;
	$image=$artist->image[1];
	if ($rank=='1'){
		$max=$playcount;
	}
}