1

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.

Volker
  • 611
  • 1
  • 7
  • 21
  • Does this answer your question? [How to get MAC address of client using PHP?](https://stackoverflow.com/questions/5074139/how-to-get-mac-address-of-client-using-php) – Jason Dec 07 '20 at 15:56
  • But if it is your app protocol, you can build it in yourself. Put the client MAC into your communication. – raiserle Dec 08 '20 at 09:01

1 Answers1

0

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.

raiserle
  • 677
  • 8
  • 31