Created
April 7, 2020 05:28
-
-
Save kcchien/953375567154df7c9d6f5f516dcf7d4f to your computer and use it in GitHub Desktop.
This file contains 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 | |
$ipAddress=$_SERVER['REMOTE_ADDR']; | |
$matches=array(); | |
echo 'IP:' . $ipAddress . '<br>'; | |
# Execute arp | |
$arp=`arp -a $ipAddress`; | |
# Parsing MAC address from arp result | |
preg_match('/([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}/', $arp, $matches); | |
# MAC address will be stored at index 0 of the array | |
echo 'MAC Address: ' . $matches[0]; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment