[PHP]Get song info from bandit.se

Submitted by patrik on Sat, 2008-01-05 19:57

//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

//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]);

//Build the line to show and show it
$info="$artist "."$title ".$album;
echo $info;