Jump to content

MAC Address


systech44

Recommended Posts

Hello,

 

Please let me know what is the wrong with the following lines of code. I am trying to find the MAC Address of the user who is logging. When I am running the code in localhost it is working. But the same code is not working when I upload it in the server.

 

<?php
function getMac(){
exec("ipconfig /all", $output);
foreach($output as $line){
if (preg_match("/(.*)Physical Address(.*)/", $line)){
$mac = $line;
$mac = str_replace("Physical Address. . . . . . . . . :","",$mac);
}
}
return $mac;
}

$mac = getMac();
$mac = trim($mac);
echo $mac;
?>

 

Please help. Thanks a lot in advance.

 

Regards & Thanks.

Link to comment
https://forums.phpfreaks.com/topic/221752-mac-address/
Share on other sites

The code displayed is working properly in the localhost. But the code is not working from the server. The server is the linux version. I upload the same script in the server. Now I am trying to see the mac of my PC. I do not found it. My question is, 'Is there a way to get client's MAC address who is accessing the website?'. Please help.

Link to comment
https://forums.phpfreaks.com/topic/221752-mac-address/#findComment-1149811
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.