//This code uses bandittracker.metalscene.se to fetch info about
// what the metal web radio station bandit.se is playing right now.
//©Patrik Hermansson 2008
//URL to fetch
$url = "http://bandittracker.metalscene.se/rightspots.php";
//Fetch the web page
$str = file_get_contents($url);
//Remove and
tags, leave the content
$content=strip_tags($str);
//Get the song info
preg_match('/Artist:([^<]*)Up Next/i', $content, $matches);
$songInfo = trim($matches[1]);
//Split at two or more spaces or newlines
$pieces = preg_split("/[\s,\n\r][\s,\n\r]+/", $songInfo);
//Add text 'Artist:', get song title and album title
$artist="Artist: ".trim($pieces[0]);
$title=trim($pieces[1]);
$album=trim($pieces[2]);
//Build the line to show and show it
$info="$artist "."$title ".$album;
echo $info;
?>