Skip to content
Advertisement

PHP: Get client MAC address

i want to get the client MAC address from an connected socket. usually you can get the IP-address via

$ip = stream_socket_get_name($socket, true);

is there any chance to get the MAC at the same way? i know all about the facts that the real MAC is only available in a local network and also this hack:

exec("arp $ip");

but i want to avoid to execute an external tool.

volker.

Advertisement

Answer

There is no way, the MAC is not included in the TCP/IP stack and once routed, the client MAC is not visible. MAC = Layer 2

— edit:

But if it is your app protocol, you can build it in yourself. Put the client MAC into your communication.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement