PHP 7 Script to Find MAC Address of a Device Using System Command in Browser Full Project For Beginners

  • Post author:
  • Post category:PHP
  • Post comments:0 Comments

 

Welcome folks today in this blog post we will be finding mac address of a device using system command in browser using php 7. All the full source code of the application is shown below.

 

 

 

Get Started

 

 

 

In order to get started you need to make an index.php file and copy paste the following code

 

 

index.php

 

 

<?php  
   //Buffering the output
   ob_start();  
   
   //Getting configuration details 
   system('ipconfig /all');  
   
   //Storing output in a variable 
   $configdata=ob_get_contents();  
   
   // Clear the buffer  
   ob_clean();  
   
   //Extract only the physical address or Mac address from the output
   $mac = "Physical";  
   $pmac = strpos($configdata, $mac);
   
   // Get Physical Address  
   $macaddr=substr($configdata,($pmac+36),17);  
   
   //Display Mac Address  
   echo $macaddr;  
   
?>

Leave a Reply