PHP Test

Show Last 10 Played Songs ... Show Current Playlist ... *********************************************************************************** You can use CSS to style the outputs e.g. or '.nowPlaying($song).' '; ?> *********************************************************************************** */ // CONFIG $station = 'Radio-skala'; // Station name $errortext = 'Currently no data available!'; // This text will appear when the api is not available // END CONFIG // Don't change anything from here! $check_api = @fsockopen("api.laut.fm", 80, $errno, $errstr, 20); function nowPlaying($song) { global $station; global $check_api; global $errortext; if($check_api) { $temp = @file_get_contents("http://api.laut.fm/radio-skala/".$station."/last_songs"); $temp = json_decode($temp); $song = htmlspecialchars($temp[0]->artist->name)." - ".htmlspecialchars($temp[0]->title); } else { $song = $errortext; } return $song; } function lastTen() { global $station; global $check_api; global $errortext; if($check_api) { $temp = @file_get_contents("http://api.laut.fm/radio-skala/".$station."/last_songs"); $temp = json_decode($temp); for($i = 0; $i < count($temp); $i++) { echo htmlspecialchars($temp[$i]->artist->name)." - ".htmlspecialchars($temp[$i]->title)." \n"; } } else { echo $errortext; } } function currentPlaylist() { global $station; global $check_api; global $errortext; if($check_api) { $temp = @file_get_contents("http://api.laut.fm/radio-skala/".$station); $playlist = json_decode($temp); echo htmlspecialchars($playlist->current_playlist->name); } else { echo $errortext; } } ?>
Loading...

Kommentare sind geschlossen.