[TIP] Checking to see if an mp3 station is online
| From: | Todd Eddy | Date: | Tue, 26 Dec 2000 08:31:29 +0000 |
| Subject: | [TIP] Checking to see if an mp3 station is online | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-31832@lists.php.net to get a copy of this message | ||
If you run a couple MP3 servers, you might want to automatically let
people know what servers are online and offline. It's remarkably very
easy. I initally found this posted by jamie.watt@murchison.com.au on
the www.php.net/manual/function.fopen.php page and I thought I would
give try and see if it would work, and it does! You can see it at
http://www.vrillusions.com/test.php3?url=http://ip:port/
and the source
for it is below:
REMEBER TO REMOVE THE . IN FRONT OF THE HTML TAGS
<.html><.body>
<?
if ($url) {
$fp = @fopen($url,"r");
if ($fp) { echo "$url is online"; }
else { echo "$url is offline"; }
}
else {
echo "Please enter a url, here's an example:<br><br>\n";
echo "...$PHP_SELF?url=http://www.vrillusions.com/";
}
?>
<./body><./html>
as you can see, its very easy to turn it into a function and run it for
several servers. Hope this helps anyone that's had that idea in their
heads.
--
Todd Eddy
vrillusions@mail.com
http://www.vrillusions.com/
I acceept PGP secured mail, You can get my public key at:
http://www.vrillusions.com/contact/