PHP Gets the MAC address, CPU serial number, motherboard serial number via Windows system command WMIC source code as follows: Class hardwareinfo{//Get MAC Address function getmacaddress () {$return _arry = Array (); @exec ("WMIC nicconfig get MACAddress", $return _arry); $mac _addr = $return _arry[1]; $mac _addr = Str_replace (":", "", $mac _addr);//Remove the characters in the string ":" Return $mac _addr;} Gets the CPU serial number function Getcpusn () {$return _arry = array (), @exec ("WMIC CPU get Processorid", $return _arry); $cpu _sn = $retur N_ARRY[1]; return $CPU _SN; }//Get motherboard serial number function Getbaseboardsn () {$return _arry = array (); @exec ("WMIC baseboard get SerialNumber", $return _arry); $b ASEBOARD_SN = $return _arry[1]; $baseboard _SN = Str_replace ("-", "", $baseboard _sn);//Remove the characters in the string "-" return $baseboard _SN; }} Use Example:
include' hardwareinfo.php '; $hw _addr = new Hardwareinfo (); $mac _addr = $hw _addr->getmacaddress (); $cpu _sn = $HW _addr-> Getcpusn (); $baseboard _sn = $hw _addr->getbaseboardsn (); Echo ' MAC address: '. $mac _addr. '
'; Echo ' CPU serial number:: '. $cpu _sn. '
'; Echo ' motherboard address:: '. $baseboard _sn. '
'; supplement: the use of WMIC commands can be consulted: http://blog.csdn.net/hnllc2012/article/details/48733383
The above describes the PHP get through the Windows System command WMIC get MAC address, CPU serial number, motherboard serial number, including aspects of the content, want to be interested in PHP tutorial friends helpful.