fringradio
New Member
I don't know if I can post this here if not I'm sorry!
I have made some little bits of PHP that can help you with your site!
Stream Status message:
Next is a player that only comes up when you are connected to the server!
I have one or two more little bits of script of general web development that I can share if anyone wants them!
Callum
I have made some little bits of PHP that can help you with your site!
Stream Status message:
PHP:
<?php
$server = "shoutcast.internet-radio.org.uk";
$port = "0000"; // port of your internet radio server
$online = "<marquee> <p>We are online! :)</p> </marquee>"; // Online Message
$offline = "<marquee> <p>Sorry we are offline :( </p></marquee>"; // offline Message
// Start Data Collection
$fp = fsockopen("$server", $port, $errno, $errstr, 30);
fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)\r\n\r\n");
while (!feof($fp)) {
$content .= fgets($fp,128);
}
fclose($fp);
// start data processing
$debut = strpos($content, '<body>') + strlen('<body>');
$fin = strpos($content, '</body>', $debut);
$string = substr($content, $debut, $fin - $debut);
$stats = explode(',', $string);
// Start Image generation
// Dedug Status echo "$stats[1]";
//offline
if ($stats[1] == "0" || !$stats) {
echo("$offline");
}
//online
if ($stats[1] == "1") {
echo("$online");
}
?>
Next is a player that only comes up when you are connected to the server!
PHP:
<?php
$server = "shoutcast.internet-radio.org.uk";
$port = "00000"; // port of your internet radio server
$online = "<html>
<head>
<title>Your Radio Station pop up player</title>
<link href=\"style.css\" type=\"text/css\" rel=\"stylesheet\" />
</title>
</head>
<body>
<OBJECT id=\"VIDEO\" width=\"320\" height=\"240\"
style=\"position:absolute; left:0;top:0;\"
CLASSID=\"CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6\"
type=\"application/x-oleobject\">
<PARAM NAME=\"URL\" VALUE=\"http://shoutcast.internet-radio.org.uk: YOUR PORT NUMBER!!!\">
<PARAM NAME=\"SendPlayStateChangeEvents\" VALUE=\"True\">
<PARAM NAME=\"AutoStart\" VALUE=\"True\">
<PARAM name=\"uiMode\" value=\"none\">
<PARAM name=\"PlayCount\" value=\"9999\">
<param name=\"ShowControls\" value=\"-1\">
<PARAM NAME=\"Enabled\" VALUE=\"-1\">
<param name=\"ShowStatusBar\" value=\"True\">
</OBJECT>
</body>
</html> ";
$offline = "<html>
<head>
<title>Fring Radio Offline</title>
<link href=\"style.css\" type=\"text/css\" rel=\"stylesheet\" />
</title>
</head>
<body>
<img src=\"http://forum.internet-radio.org.uk/images/offline.gif\" /></body>
</html>"; // offline
// Start Data Collection
$fp = fsockopen("$server", $port, $errno, $errstr, 30);
fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)\r\n\r\n");
while (!feof($fp)) {
$content .= fgets($fp,128);
}
fclose($fp);
// start data processing
$debut = strpos($content, '<body>') + strlen('<body>');
$fin = strpos($content, '</body>', $debut);
$string = substr($content, $debut, $fin - $debut);
$stats = explode(',', $string);
// Start Image generation
// Dedug Status echo "$stats[1]";
//offline
if ($stats[1] == "0" || !$stats) {
echo("$offline");
}
//online
if ($stats[1] == "1") {
echo("$online");
}
?>
I have one or two more little bits of script of general web development that I can share if anyone wants them!
Callum
Last edited: