1
Feature Requests / Re: Feature Request: Multiple Operators
« on: 2016-04-19, 20:47:30 »
with your input here i updated the Control unit and yes, i see the MAC addresses. Put some PHP code together to have the connection information in a simple form that i can embed into the club website. (not yet public online, comming soon). Here the code (needs some optimizing and cleanup .....
It connects to the control RRC with Username and Passwort. Just the Status.htm page is called and then get the lines for connection status and MAC address.
as soon the page is online i'll post the link so you can see this looks like.
73' Serge , HB9EDI
update, the link: http://racr.godo.ch/
It connects to the control RRC with Username and Passwort. Just the Status.htm page is called and then get the lines for connection status and MAC address.
Code: [Select]
<?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;
}
?>
as soon the page is online i'll post the link so you can see this looks like.
73' Serge , HB9EDI
update, the link: http://racr.godo.ch/