![]() Sometimes, particularly when you're dealing with an anonymizing proxy that you don't control, the proxy won't return the real IP address, and all you can hope for is the IP address of the proxy. a caching proxy) $_SERVER will return the IP of the proxy, and there will be an extra value, often $_SERVER, that contains the IP of the original request client. In some scenarios, particularly if your web server is behind a proxy (i.e. The MAC address of a client (in the sense of the computer that issued the HTTP request) is overwritten by every router between the client and the server.Ĭlient IP is conveniently provided to the script in $_SERVER. Well, you're out of luck unless you can have the client volunteer that information and transmit via other means. Solution 4 - Php For windows server I think u can use this: Solution 5 - Php All you need to do is to put arp into diferrent group.#look for the output line describing our IP address I don't think you can get MAC address in PHP, but you can get IP from SERVER 'REMOTEADDR' variable. #run the external command, break output into lines So, if you are building some kind of LAN based system and your clients are on the same ethernet segment, then you could get the MAC address by parsing the output of arp -n (linux) or arp -a (windows).Įdit: you ask in comments how to get the output of an external command - one way is to use backticks, e.g. The client MAC address will not be available to you except in one special circumstance: if the client is on the same ethernet segment as the server. You can get the client IP from $_SERVER Client MAC address Server MAC addressįor the MAC address, you could parse the output of netstat -ie in Linux, or ipconfig /all in Windows. You can get the server IP address from $_SERVER. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |