How can I get the MAC and the IP address of a connected client in PHP?

前端 未结 16 2356
长发绾君心
长发绾君心 2020-11-22 02:29

I need to know the MAC and the IP address of the connect clients, how can I do this in PHP?

16条回答
  •  孤独总比滥情好
    2020-11-22 03:07

    All you need to do is to put arp into diferrent group.

    Default:

    -rwxr-xr-x 1 root root 48K 2008-11-11 18:11 /usr/sbin/arp*
    

    With command:

    sudo chown root:www-data /usr/sbin/arp
    

    you will get:

    -rwxr-xr-x 1 root www-data 48K 2008-11-11 18:11 /usr/sbin/arp*
    

    And because apache is a daemon running under the user www-data, it's now able to execute this command.

    So if you now use a PHP script, e.g.:

    
    

    you will get the output of linux arp -an command.

提交回复
热议问题