MAC address from Linux with PHP
<?php
function getMacLinux() {
exec('netstat -ie', $result);
if(is_array($result)) {
$iface = array();
foreach($result as $key => $line) {
if($key > 0) {
$tmp = str_replace(" ", "", substr($line, 0, 10));
if($tmp <> "") {
$macpos = strpos($line, "HWaddr");
if($macpos !== false) {
$iface[] = array('iface' => $tmp, 'mac' =>strtolower(substr($line, $macpos+7, 17)));
}
}
}
}
return $iface[0]['mac'];
} else {
return "notfound";
}
}
?>
Found it on http://www.zimplicit.se/en/knowledge/how-get-mac-address-linux-php
I used this code for linux ,but it is not giving result on server,
empty MAC address.!!
Any solution?