Hier sind verschiedene Beispiele, wie Sie Informationen von der öffentlichen API auf Ihrer eigenen Website abrufen können. Die Beispiele sind in PHP mit dem PHP-Tool verfügbar.
Bild des Moderators
<?php $station = "2"; //ID Der Station bei Azuracast $json_station = file_get_contents("https://demo.azuracast.com/api/nowplaying/".$station); $obj_station = json_decode($json_station); $live = $obj_station->live->streamer_name; $pls = $obj_station->now_playing->playlist; ?> <img src="//Pfat zum /img/<?php if(empty($live)) {echo $pls;}else{echo $live;} ;?>.jpg" alt="<?php if(empty($live)) {echo $pls;}else{echo $live;} ?>" style="width:250; height:auto;"><br>
Name of the moderator
<?php $station = "2"; //ID Der Station bei Azuracast $json_station = file_get_contents("https://demo.azuracast.com/api/nowplaying/".$station); $obj_station = json_decode($json_station); $live = $obj_station->live->streamer_name; $pls = $obj_station->now_playing->playlist; ?><?php if(empty($live)) {echo $pls;}else{echo $live;} ?>
Aktueller Titel
<?php $station = "2"; $json_station = file_get_contents("https://demo.azuracast.com/api/nowplaying/".$station); $obj_station = json_decode($json_station); echo "Aktuell läuft: " . $obj_station->now_playing->song->text ?>
Nächster Titel
<?php $station = "2"; $json_station = file_get_contents("https://demo.azuracast.com/api/nowplaying/".$station); $obj_station = json_decode($json_station); echo "Als nächstes Kommt: " . $obj_station->playing_next->song->text ?>
Wichtig: Die PHP-Beispiele werden nicht aktualisiert Apache-Lizenz 2.0 https://github.com/AzuraCast/AzuraCast/blob/master/LICENSE.txt