How to get MAC address of client using PHP?

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

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

10条回答
  •  伪装坚强ぢ
    2020-11-28 09:15

    //Simple & effective way to get client mac address
    // Turn on output buffering
    ob_start();
    //Get the ipconfig details using system commond
    system('ipconfig /all');
    
    // Capture the output into a variable
    
        $mycom=ob_get_contents();
    
    // Clean (erase) the output buffer
    
        ob_clean();
    
    $findme = "Physical";
    //Search the "Physical" | Find the position of Physical text
    $pmac = strpos($mycom, $findme);
    
    // Get Physical Address
    $mac=substr($mycom,($pmac+36),17);
    //Display Mac Address
    echo $mac;
    

提交回复
热议问题