PHP: How to Get MAC Address for Current System Using PHP
Here is the below code in PHP that is used to get MAC address in PHP
<?php
ob_start(); // Turn on output buffering
system('ipconfig /all'); //Execute external program to display output
$capout=ob_get_contents(); // Capture the output into a variable
ob_clean(); // Clean the output buffer
$findcurrentsystem = "Physical";
$pmac = strpos($capout, $findcurrentsystem); // Find the position of Physical text
$mac=substr($capout,($pmac+36),17); // Get Physical Address
echo $mac;
?>
Comments
One Comment on PHP: How to Get MAC Address for Current System Using PHP
-
Suman on
Sat, 25th Dec 2010 8:43 am
i will shut down all computers in world… if the above thing works
Tell me what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!





