RadioDJ - Free Radio Automation Software Forum

Show ShoutCast Data

EmmaSts

Show ShoutCast Data
« on: December 24, 2019, 04:09:09 PM »
Hello,

Had a couple of emails asking how to use the ShoutCastXML to display information so thought I'd post a thread for any who wants a small simple tutorial :)

Firstly download the ShoutcastXML from http://stewartswebworks.com/radiodjsites.php

Open it and fill in your server info...
Code: [Select]
$url = "http://SERVER-IP:PORT/stats"; // Change URL and PORT number

After that It's just a simple php echo of the variables you want to show so for eg:
Code: [Select]
<ul>
  <li>Stationname: <?php echo $servname?></li>
  <li>Status: <?php echo $status?></li>
  <li>Playing: <?php echo $song?></li>
  <li>Listeners: <?php echo $cners?></li>
  <li>Genre: <?php echo $genre?></li>
  <li>URL: <a href="http://<?php echo $servurl?>"><?php echo $servurl?></a></li>
  <li>Broadcast bitrate: <?php echo $brate?>kb/s</li>
</ul>
See the STATS at the foot of https://www.xperiencerewind.co.uk/

//////////////////////////////////////////////////////////////////////////////////////////////////////
If you'd like to have an on air / off air use if/else statements with the STREAMSTATUS...

Code: [Select]
$status = $xml->STREAMSTATUS;
if($status == '0'){
$status = 'Off-air - no broadcast';
}elseif($status == '1'){
$status = 'On-air - Broadcasting live';
}

Thank you!