Home Backend Development PHP Tutorial PHP code to obtain the computer's unique identification information (cpu, network card, MAC address)

PHP code to obtain the computer's unique identification information (cpu, network card, MAC address)

Jul 25, 2016 am 09:00 AM
network card

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];
  }
 }
}
?>
Copy after login
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



Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What kind of network card is Crab card? What kind of network card is Crab card? Oct 09, 2022 pm 02:42 PM

The crab card refers to the Realtek network card. Its icon looks like a crab, so it is called the crab card network card. A network card is a piece of computer hardware designed to allow computers to communicate on a computer network, allowing users to connect to each other via cables or wirelessly. Realtek uses the crab as its corporate logo and hopes that it can imitate the symbolism of the crab's tenacity, fearlessness, and courage to challenge in nature.

How to check whether the network card is normal in Linux How to check whether the network card is normal in Linux Mar 22, 2023 am 10:08 AM

How to check whether the network card is normal in Linux: 1. Check the network card status through the "mii-tool" command; 2. Check the network status through "network status"; 3. Check the information of all network interfaces in Linux through the "ifconfig -a" command; 4. Query the network card information through the "ethtool" command.

How to uninstall the network card driver on win11 How to uninstall the network card driver on win11 Dec 28, 2023 pm 07:04 PM

The mismatch of the network card driver will result in the inability to access the Internet normally, but it cannot be updated normally. At this time, you can uninstall the network card driver in win11 and then reinstall it to solve the problem. You only need to operate it in the device manager. Tutorial on uninstalling the network card driver in win11: 1. First, right-click the "Windows Logo" at the bottom. 2. Then click on "Device Manager" in the right-click menu. 3. After opening, expand "Network Adapters" and find the network card device. 4. Then double-click to open the device you want to uninstall the driver, enter "Driver" 5. Finally, select "Uninstall Device" to uninstall the win11 network card driver.

How to check the network card in linux How to check the network card in linux Jan 05, 2023 pm 02:16 PM

How to check the network card in Linux: 1. Check the network interface information through the "ifconfig" command; 2. Check the network card device list through the "lspci | grep -i 'eth'" or "lspci | grep -i net" command; 3. Use the "iwconfig" command to check whether there is a wireless network card device on the device; 4. Use the "ethtool" command to query the configuration network card parameters.

How to check the network card of linux How to check the network card of linux Aug 04, 2023 pm 01:50 PM

How to check the network card in Linux: 1. Use the ifconfig command, which is one of the most commonly used commands in Linux systems and is used to view and configure network interfaces; 2. Use the ip command, which is another powerful tool for network management in Linux systems. ;3. View the /proc/net/dev file to obtain more detailed network statistics than the ifconfig and ip commands.

How to check the information and number of network cards in Linux system? How to check the information and number of network cards in Linux system? Feb 19, 2024 pm 02:06 PM

Generally refers to GNU/Linux, which is a set of Unix-like operating systems that are free to use and freely disseminated. It is a multi-user, multi-task, multi-threading and multi-CPU operating system that follows POSIX. In a Linux system, network connection is a crucial part. It is the key to ensuring that the server or computer can communicate with the network. So how to check how many network cards there are in Linux? Let’s take a look at the detailed introduction. In Linux, you can use the following methods to check how many network cards there are in the system: 1. ifconfig command ifconfig is a command used to manage network interface information. You can view all network interfaces in the system by running the ifconfig command

What should I do if Linux cannot find the network card device? What should I do if Linux cannot find the network card device? Mar 24, 2023 am 09:53 AM

Solution to the problem that Linux cannot find the network card device: 1. Log in to the Linux system and enter the terminal; 2. Execute the "systemctl stop NetworkManager systemctl disable NetworkManager systemctl start network.service service network restart" command to restart the network card.

A simple way to check the network card model in WIN10 A simple way to check the network card model in WIN10 Mar 27, 2024 pm 10:01 PM

1. Download and install Master Lu. 2. Open Master Lu--Hardware Detection

See all articles