PHP get MAC address, CPU serial number, motherboard serial number via Windows system command WMIC

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.