Aşağıdaki kodu kendinize göre düzenleyerek deneyebilirsiniz.
<?php
$station_name = "Radio Station Name";
$refresh = "60";
$timeout = "1";
/* ----------- Server configuration ---------- */
// Note: dikkat http:// bolumunu yazmayiniz
// Asagidaki bolume radyonuzun ip ve port nosunu yaziniz
$ip[1] = "yayin.damarfm.com";
$port[1] = "8080";
/* Relays: Below you can enter more relays / restreams / channels / competitors or anything else */
/* ----- No need to edit below this line ----- */
/* ------------------------------------------- */
$servers = count($ip);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<?php
if ($refresh != "0")
{
print "<meta http-equiv=\"refresh\" content=\"$refresh\">\n";
}
print "<title>$Radyomuzdaki Dinleyici Sayisi</title>\n";
?>
<style type="text/css">
<!--
.sanatci {
margin-top:5px;
margin-left:15px;
padding-top:5px;
padding-left:20px;
height:20px;
width:500px;
border:1px solid #ffffff;
background-color:#000000;
color: #ffffff;
font-family:Arial,Helvetica,sans-serif;
font-size:14px;
border-radius:8px;
}
.red {
color: #990e99;
font-weight: bold;
}
-->
</style>
</head>
<body>
<?php
$i = "1";
while($i<=$servers)
{
$fp = @fsockopen($ip[$i],$port[$i],$errno,$errstr,$timeout);
if (!$fp)
{
$listeners[$i] = "0";
$msg[$i] = "<span class=\"red\">ERROR [Connection refused / Server down]</span>";
$error[$i] = "1";
}
else
{
fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla\r\n\r\n");
while (!feof($fp))
{
$info = fgets($fp);
}
$info = str_replace('<HTML><meta http-equiv="Pragma" content="no-cache"></head><body>', "", $info);
$info = str_replace('</body></html>', "", $info);
$stats = explode(',', $info);
if (empty($stats[1]) )
{
$listeners[$i] = "0";
$msg[$i] = "<span class=\"red\">Hata [Radyo Baglanamadi]</span>";
$error[$i] = "1";
}
else
{
if ($stats[1] == "1")
{
$song[$i] = $stats[6];
$listeners[$i] = $stats[0];
$max[$i] = $stats[3];
$bitrate[$i] = $stats[5];
$peak[$i] = $stats[2];
if ($stats[0] == $max[$i])
{
}
}
{
$listeners[$i] = "0";
$msg[$i] = " <span class=\"red\">Hata [Radyo Baglanamadi]</span>";
$error[$i] = "1";
}
}
}
$i++;
}
print " <div class='sanatci'>Sanatci ismi: $song[1] </div>";
?>
</body>
</html>