Prev Previous Post   Next Post Next
Old 17th June 2003, 01:50   #2
Tom
Moderator
 
Join Date: Apr 2000
Posts: 4,491
<?php

/******************************************************************
Am I off or online?
Simple function to check if your SHOUTcast server has a source connected and
is online.

License, free, use like the wind blows. Be nice and recognize that
it was written by Jay Krivanek of <a href="http://www.radiotoolbox.com" target="_blank">www.radiotoolbox.com</a> <img src="images/smilies/wink.gif" border="0" alt="">
******************************************************************/

$host="24.57.242.197";
$port=8010;
$wait_sec=2;


$fp = fsockopen($host, $port, &$errstr, &$errno, $wait_sec);

if ($fp)
{
fputs($fp, "GET / HTTP/1.0\r\nUser-Agent:AmIoffOrOn\r\n\r\n");

$ret = fgets($fp, 255);

if (ereg("200", $ret))
{
echo "Online";
}
else
{
echo "Offline";
}

fclose($fp);
}
else
{
echo "Offline";
}


?>
Tom is offline   Reply With Quote
 
Go Back   Winamp & Shoutcast Forums > Shoutcast > Shoutcast Technical Support

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump