1function getMacLinux() {
2 exec('netstat -ie', $result);
3 if(is_array($result)) {
4 $iface = array();
5 foreach($result as $key => $line) {
6 if($key > 0) {
7 $tmp = str_replace(" ", "", substr($line, 0, 10));
8 if($tmp <> "") {
9 $macpos = strpos($line, "HWaddr");
10 if($macpos !== false) {
11 $iface[] = array('iface' => $tmp, 'mac' => strtolower(substr($line, $macpos+7, 17)));
12 }
13 }
14 }
15 }
16 return $iface[0]['mac'];
17 } else {
18 return "notfound";
19 }
20}