Get Client Machine Name in PHP

后端 未结 6 577
借酒劲吻你
借酒劲吻你 2020-12-30 23:58

This program only returns the client machine name in localhost only

echo gethostbyaddr($_SERVER[\'REMOTE_ADDR\']);

If it is run from an online s

6条回答
  •  一整个雨季
    2020-12-31 00:40

    What's this "other information"? An IP address?

    In PHP, you use $_SERVER['REMOTE_ADDR'] to get the IP address of the remote client, then you can use gethostbyaddr() to try and conver that IP into a hostname - but not all IPs have a reverse mapping configured.

提交回复
热议问题