Jump to content

Getting a MAC address with PHP


Suchy

Recommended Posts

I have a people rating site and once in a while I get an email either from the cops or lawyers asking for ip address and MAC address of a someone who wrote an inappropriate comment.

Collecting the ip address is no problem, but is it possible to get the mac address via php? I been searching for this and so far no luck.

Link to comment
Share on other sites

You can't get a mac address of a client machine. It isn't sent with the request unless it's on the same subnet. If the request traverses any layer 3 device (such as a router on the internet) the only mac address you'll have even a remote chance of obtaining is that of the last device to forward the packets to your server, which will be the same for all packets received from the outside.

Link to comment
Share on other sites

To add to Pika's answer, MAC addresses and TCP operate at entirely different OSI layers.  In general, the higher the level, the more abstract.  HTTP is built upon TCP  which is layer 4.  To be dogmatic about it, HTTP at layer 7 makes absolutely no provision for even IP.  The reason you have access to IP addresses at all in php is because they come from the old cgi specification, and are provided by the http server itself which implements the socket server.  There is no place in HTTP where even the IP address is part of the specification.

 

Ethernet where the MAC address comes into play is layer 1.  There is no reason for IP and certainly not TCP to be concerned with MAC addresses -- they need to be entirely transparent.  If things weren't transparent, different network technologies would not be able to interoperate.  One of the fundamental concepts enabling the internet, is that of routing, where you are able to send a packet to a destination IP from your network, without any real idea how the packet is going to get to the destination, since routers are able to delegate an understanding of where the packets need to go next, to other routers which advertise routes.

 

People requesting a Mac address from you as a website owner, truly don't know what they are talking about.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.