Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get MAC address of client using PHP?

Tags:

php

ip

How can I get MAC Address using PHP or javascript...

like image 213
kim edgard Avatar asked Feb 22 '11 04:02

kim edgard


People also ask

How can I get client IP address in PHP?

The simplest way to collect the visitor IP address in PHP is the REMOTE_ADDR. Pass the 'REMOTE_ADDR' in PHP $_SERVER variable. It will return the IP address of the visitor who is currently viewing the webpage.

Can a website capture MAC address?

To answer the original question, a web site can read your MAC address, but they need to have special scripts on their servers and force your browser to download them.

Can you get MAC address using JavaScript?

No you cannot get the MAC address in JavaScript, mainly because the MAC address uniquely identifies the running computer so it would be a security vulnerability.


1 Answers

The MAC address (the low-level local network interface address) does not survive hops through IP routers. You can't find the client MAC address from a remote server.

In a local subnet, the MAC addresses are mapped to IP addresses through the ARP system. Interfaces on the local net know how to map IP addresses to MAC addresses. However, when your packets have been routed on the local subnet to (and through) the gateway out to the "real" Internet, the originating MAC address is lost. Simplistically, each subnet-to-subnet hop of your packets involve the same sort of IP-to-MAC mapping for local routing in each subnet.

like image 144
Pointy Avatar answered Oct 03 '22 02:10

Pointy