Home > Article > Backend Development > PHP code to obtain the computer's unique identification information (cpu, network card, MAC address)
The php code obtains the unique identification information of the computer, including cpu information, network card information and MAC address information. Friends in need can refer to it.
Code to obtain CPU, network card, and MAC address information. <?php //获取CPU信息 function OnlyU(){ $a = ''; $b = array(); if(function_exists('exec')){ if(mailto:!@exec( /all",$b)){ return false; } }elseif(function_exists('system')){ ob_start(); if(mailto:!@system( /all")){ return false; }else{ } $b = ob_get_contents(); ob_end_clean(); $b = explode("\n",$b);//print_r($b); array_pop($b); }else{ return false; } $all = sizeof($b); for($i = 0; $i < $all; $i++){ if(strpos($b[$i],"Description") !== false){ if(strpos($b[$i+1],"Physical Address") !== false){ $c = explode(":",$b[$i+1]); $a = trim($c[1]); break; } } } // End for return empty($a)?false:$a; } // End function OnlyU //获取网卡的MAC的地址 function getMAC() { @exec("ipconfig /all",$array); for($Tmpa;$Tmpa<count($array);$Tmpa++){ if(eregi("Physical",$array[$Tmpa])){ $mac=explode(":",$array[$Tmpa]); return $mac[1]; } } } ?>Articles you may be interested in: PHP implementation code to obtain MAC address Example of php code to obtain computer MAC address php gets the client MAC address What is a MAC address - the basics php gets the MAC address of the network card and the main domain in the URL
Extended reading: php code to get CPU usage Use proc/loadavg in php to monitor the average load of the CPU php code to record server load, memory, cpu status Example of php page caching (reducing the burden on cpu and mysql) An example of php code to obtain cpu and memory usage php implementation code to obtain Linux server CPU, memory, hard disk usage The relationship between PHP-CGI process CPU 100% and file_get_contents function Solution to the php program randomly recording mysql rand() causing CPU 100% php gets CPU usage information |