If you are using the Remoterig for your Club station you will probably miss a user management. Or at least i wanted to see who is connected right now. After some hints from Microbit, since one of the latest firmware’s the MAC address is shown in the status page. This brought me to the idea to create a PHP script that reads the page, as well the Webswitch status and display the logged in user.
PHP script to read Remoterig and Webswitch status and connection, resolve according MAC address to Call. <?PHP
$username = "Web page user";
$password = "Web page pwd";
$remote_url = 'http://RRC.ddns.remoterig.com/status.htm';
// Create a stream
$opts = array(
'http'=>array(
'method'=>"GET",
'header' => "Authorization: Basic " . base64_encode("$username:$password")
)
);
$context = stream_context_create($opts);
// Open the file using the HTTP headers set above
$file = file_get_contents($remote_url, false, $context);
if (!$file) {
echo "<b>ERROR</b>";
exit;
}
$searchfor = 'Connection status';
$pattern = preg_quote($searchfor, '/');
$pattern = "/^.*$pattern.*\$/m";
if(preg_match_all($pattern, $file, $matches)){
$text = implode("\n", $matches[0]);
$output = substr($text, 25);
if (strpos($output, 'OK') !== false) {
$state = 'Connected : ';
} else {
$state = 'Ready for connection. Last User : ';
}
echo $state;
}
$searchfor = '(mac)';
$pattern = preg_quote($searchfor, '/');
$pattern = "/^.*$pattern.*\$/m";
if(preg_match_all($pattern, $file, $matches)){
$text = implode("\n", $matches[0]);
$output = substr($text, 24);
//echo "<br>";
//echo $output;
//echo "<br>";
if (strpos($output, '00:1e:fd:aa:bb:cc') !== false) {
$call = 'HB9EDI';
} elseif (strpos($output, '00:1e:fd:dd:ee:ff') !== false){
$call = 'HB9whatever';
}
else {$call = "Unknown Call from MAC address " . $output;}
echo $call;
}
?>
|
perhaps it’s of use for others. I’m happy with it.
73′ HB9EDI