How Do I Get Mac Address Of Client PC Using Php

1 answers
Thread Answer
Omar
How do i get MAC Address of Client Using PHP
I have use
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";
  }
}


but it's giving server's MAC Address
is anyone know ???
vincent
Basically, you can't.
The MAC address is not broadcast beyond the LAN the device is connected to - it never leaves the router and passes to the server.

In theory you can get it in Javascript since that runs on the Client, but...and it's a big but...it's not going to work except in exceptional circumstances: you need to use an ActiveX control to get the MAC, and they only run under IE, and most systems default to "don't run ActiveX controls" to prevent all sorts of security problems.

If you want to use the MAC for identification, then don't bother - it won't do what you want most of teh time, and it is spectacularly simple to spoof. And there is also the fun that they aren't necessarily unique - just unique within the LAN segment...