Today i will explain you a short PHP snippet to get the computer mac address using PHP. This is very simple PHP function. We will trigger the system commend and get the mac address.
You can view demo and download how get system Mac Address using PHP:
// Turn on output buffering ob_start(); //Get the ipconfig details using system commond system('ipconfig /all'); // Capture the output into a variable $mycom=ob_get_contents(); // Clean (erase) the output buffer ob_clean(); $findme = "Physical"; //Search the "Physical" | Find the position of Physical text $pmac = strpos($mycom, $findme); // Get Physical Address $mac=substr($mycom,($pmac+36),17); //Display Mac Address echo $mac; //If you want you can track the page visitor's mac address and store in database //Insert the visitor's mac address to database // " INSERT INTO `table_name` (`column_name`) VALUES('".$mac_address."') ";
This is a simple and effective way of getting the client system Mac address using PHP. Hope it will help you.