Why does gethostbyaddr($_SERVER['REMOTE_ADDR']) return an IP address as opposed to a computer name as it should. It works as intended on 50 computers here in the office and returns the computer name. At the moment it returns an IP address on my own computer when it should return a computer name.
Is there a quick fix for this?
From the documentation:
gethostbyaddr — Get the Internet host name corresponding to a given IP address
The important part is Internet, what PHP do is a DNS lookup. At your office your roouter may make a DNS resolve for local machines, but your home is not registered on any DNS.
For depending of your need your could use : How can I read the client's machine/computer name from the browser?
But this is not something easy to do.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With