What's the code to say if my radio is online or offline? If online, I want it to say 'Online' in green, and with 'Offline' in red.
Printable View
What's the code to say if my radio is online or offline? If online, I want it to say 'Online' in green, and with 'Offline' in red.
Does your radio have an IP address and a port ?
Try it out.PHP Code:$ip = 'IPADDRESS/URL HERE';
$port = 'PORT HERE'; //Put 80 here for is you are looking for a website.
if (fsockopen($ip,$port) {
echo "<font color=\"green\">Online</font>";
} else if (!fsockopen($ip,$port) {
echo "<font color=\"red\">Offline</font>";
}
Else you can just create a site, and then when the radio is on, put the site on. (then use '80' as port)
Thanks, it does have an IP and port.
Happy to help =) if you need any more help which could involve html/php just gimme a pm/post =)
That code could be improved a bit :P
PHP Code:$ip = 'ip';
$port = 'port';
$fp = @fsockopen($ip,$port);
if ($fp){
echo "<font color=\"green\">Online</font>";
} else {
echo "<font color=\"red\">Offline</font>";
}
Argh you perfectionists =p Always got something better =p