Khalil Majdalawi's Blog Web development,Technology,Games and more…

4Jul/093

How to get client MAC address in PHP

<?php
exec('arp '.$_SERVER['REMOTE_ADDR'],$user_mac);
echo substr($user_mac[1],strpos($user_mac[1],':')-2, '17');
?>

Note : this technique only works on local area networks with linux based server and its impossible to get mac address in php over internet

Tagged as: Leave a comment
Comments (3) Trackbacks (1)
  1. this will work only on a local network.

  2. i’m got errr with ubuntu.. Notice: Undefined index: 1 in /… with cakephp framework ..

  3. check the output of “var_dump($user_mac); “


Leave a comment

(required)


*