How to get MAC address of client using PHP?

前端 未结 10 1642
长情又很酷
长情又很酷 2020-11-28 08:39

How can I get MAC Address using PHP or javascript...

10条回答
  •  时光说笑
    2020-11-28 09:18

    echo GetMAC();
    
    function GetMAC(){
        ob_start();
        system('getmac');
        $Content = ob_get_contents();
        ob_clean();
        return substr($Content, strpos($Content,'\\')-20, 17);
    }
    

    Above will basically execute the getmac program and parse its console-output, resulting to MAC-address of the server (and/or where ever PHP is installed and running on).

提交回复
热议问题