Page 1 of 1
How do i get user mac address?
Posted: Tue Jan 05, 2010 9:41 am
by kennedysee
How do i detect the user mac address when they visit the website?
Somehow i manage to detect the pc that is running apache, but not from another computer. It keep prompting the same mac address....
Re: How do i get user mac address?
Posted: Tue Jan 05, 2010 12:06 pm
by pickle
The MAC address isn't passed on any layer PHP can access.
Re: How do i get user mac address?
Posted: Tue Jan 05, 2010 12:30 pm
by eFishy
If the user is a host on the same local network you could use the arp cache to find the mac using the IP address you can get in PHP.
Although if there is a layer3 device such as a router between you and the client this wouldn't work, instead you would be returned the MAC of the routing device.
Re: How do i get user mac address?
Posted: Tue Jan 05, 2010 8:26 pm
by kennedysee
pickle wrote:The MAC address isn't passed on any layer PHP can access.
Then in what other language can i retrieve for MAC address?
<?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);
?>
Re: How do i get user mac address?
Posted: Tue Jan 05, 2010 10:47 pm
by manojsemwal1
good function i read it knowledgeable article.
Re: How do i get user mac address?
Posted: Wed Jan 06, 2010 3:17 am
by Apollo
kennedysee wrote:Then in what other language can i retrieve for MAC address?
Note that the getMac() function above gets the mac address of the server, not the visitor

(and only if the host is a windows machine)
Re: How do i get user mac address?
Posted: Wed Jan 06, 2010 9:52 am
by kennedysee
Apollo wrote:kennedysee wrote:Then in what other language can i retrieve for MAC address?
Note that the getMac() function above gets the mac address of the server, not the visitor

(and only if the host is a windows machine)
how do i get the visitor mac address?
Re: How do i get user mac address?
Posted: Wed Jan 06, 2010 10:03 am
by pickle
You can't.
Re: How do i get user mac address?
Posted: Wed Jan 06, 2010 10:13 am
by kennedysee
pickle wrote:You can't.
Any other way?