Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function getMac(){
- exec("ipconfig /all", $output);
- foreach($output as $line){
- if (preg_match("/(.*)Physical(.*)/", $line)){
- $mac = $line;
- $mac = str_replace("Physical address. . . . . . . . . :","",$mac);
- $mac = trim($mac);
- echo $mac . "</br>";
- }
- }
- return $mac;
- }
- $mac = getMac();
- $mac = trim($mac);
- echo $mac;
- ?>
- <?php ob_start(); // Turn on output buffering
- system("ipconfig /all"); //Execute external program to display output
- $mycom=ob_get_contents(); // Capture the output into a variable
- ob_clean(); // Clean (erase) the output buffer
- $findme = "Physical";
- $pmac = strpos($mycom, $findme); // Find the position of Physical text
- $mac=substr($mycom,($pmac+36),17); // Get Physical Address
- echo $mac;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement