bretticus wrote:If you pipe ifconfig -a through awk you can get just the mac addresses wihout having to parse via php scripting.
ifconfig -a | awk '/HWaddr/ {print $5}'
Thanks Bretticus for your Help..
Bretticus , Ifconfig does not shows me any field like HWaddr ....
But , I have written a script ,
function get_mac()
{
// $user_mac = shell_exec('arp -a'.$ip);
$user_mac = shell_exec('arp -a');
return $user_mac;
}
$str = $mac;
$var = preg_match("/$ip(.*)on/",$str,$matches);
$temp = $matches[1];
$var1 = preg_match("/at(.*)/",$temp,$matches);
print_r($matches[1]);
That does give me correct answer when i run on my PC.But if run on other (which is connected ) , it does give me IP and Host-name correct , but not the physical address. So what can be causing the problem ..
In above code , i have used perg_match for fetching the MAC from the result of arp -a...
Thanks a lot for your help, I really appreciate.