Reputation: 434
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?
Upvotes: 3
Views: 1914
Reputation: 434
Now as the original question points out the offending machine above operates in a intranet environment within our company. Now the solution to this problem was that IT in the company had to re-join the offending machine in this case my work computer to the domain and then run group policy. That fixed it for me on two different machines on the same intranet. This situation does not happen a lot but our IT were in the past perplexed for a solution. The above actions reverted the IP to the required machine name.
Upvotes: 0
Reputation: 133
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.
Upvotes: 2