PHP Script with Shoutcast 2

macslon

New member
I use as part of my radio website a php site

its an Shoutcast 1 Stream and it works perfect. Now i will change to my new shoutcast 2 stream (46.235.26.22:12300)

I know here is a problem with the (sid=1) but i dont know how it works when i put the new stream in my script:

<html>
<body bgcolor="#0D2A0C" text="#FFFF00">

<meta http-equiv="Refresh" content="30" />
<div align="center">
<?
$open = fsockopen("46.235.26.22","12300");
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!"; }
?>
</div>
<div align="left">
<?
if ($text[1]==1) { $state = "Up"; } else { $state = "Down"; }
if ($er) { echo $er; exit; }
echo "<font face=verdana size=3>
<u><b>Gerade l?uft:</u></b>

$text[6]


*Wir haben $text[0] Zuh?rer.*


</font>";?>
</body>
</html>


i think i want a new command on $open = fsockopen("46.235.26.22","12300");  but i dont know how i can fix it
 
Your script accesses /7.html file and that's not supported when using Shoutcast 2, you'll need to use /stats or /admin.cgi instead: http://wiki.shoutcast.com/wiki/SHOUTcast_DNAS_Server_2_XML_Reponses#Equivalent_of_7.html
 
macslon said:
mhmmm, can you show me how i place this other command in my script?
I'm afraid I don't have any code handy... Shoutcast gives you an XML data for the /admin.cgi request, so you just need to parse it in your script to get the values you need. You can open the /admin.cgi or /stats in the web browser (http://46.235.26.22:12300/stats) to see how the file looks.
 
Back
Top