Forum Moderators: coopster
I run an internet radio server and I'd like to output the current song and whether the station is currently up or down to a table on my SMF forums.
I've found some code:
$open = fsockopen("123.123.123.123","1234");
if ($open) {
fputs($open,"GET /7.html HTTP/1.1\nUser-Agent:Mozilla\n\n");
$read = fread($open,1000);
$text = explode("content-type:text/html",$read);
$text = explode(",",$text[1]);
} else { $er="Connection Refused!"; }
if ($text[1]==1) { $state = "On Air"; } else { $state = "Off Air"; }
if ($er) { echo $er; exit; }
echo "<br><font face=verdana size=1>
Server State: <b>$state</b><br>
Playing Now: $text[6]
</font>";
which is outputting things nicely but I'm trying to work out how to output insidea table 1024 across with a black background. I'm not having much luck. Can someone advise please?
Thanks
[edited by: Moif at 12:04 pm (utc) on Feb. 15, 2007]
<table width="1024">
<tr>
<td style="background-color:#000000">
<?php
if ($text[1]==1) { $state = "On Air"; } else { $state = "Off Air"; }
if ($er) { echo $er; exit; }
echo "<br><font face=verdana size=1>
Server State: <b>$state</b><br>
Playing Now: $text[6]
</font>";
?>
</td>
</tr>
</table>
dc
Thanks for the welcome :)
Unfortunatley that didn't work, I received a template parse error.
I have forums here:
<snip?
..and you can see the PHP in action underneath the menu bar. I'm trying to get that to output to a table which will eventually have a icons to click which open the stream in various players. That won't be a problem but I'm pretty new to PHP so it's baby steps right now :)
I've uploaded the index template here as a text file so you can see the rest of the code:
<snip>
The shoutcast stats start on line 607.
Thanks in advance for any advice.
[edited by: dreamcatcher at 1:24 pm (utc) on Feb. 15, 2007]
[edit reason] No URLs, thanks. [/edit]