Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function get_mac_address1() {
- exec("ipconfig /all", $arr, $retval);
- $arr[14];
- $ph = explode(":", $arr[14]);
- return trim($ph[1]);
- }
- function get_mac_address2() {
- 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
- return $mac;
- }
- echo "<pre>";
- echo get_mac_address1(), PHP_EOL;
- echo get_mac_address2(), PHP_EOL;
- echo "</pre>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement