Last active
May 29, 2021 14:35
-
-
Save taiar/4732398 to your computer and use it in GitHub Desktop.
Get MAC address from Windows host server in PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| * Getting MAC Address using PHP | |
| * Md. Nazmul Basher | |
| */ | |
| 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; |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is meant to get the physical address on the host server.