Results 1 to 3 of 3

Thread: How to get Mac Address using Php

  1. #1
    Join Date
    May 2009
    Posts
    41

    How to get Mac Address using Php

    I want to have mac address whenever any user visit my site by using any Php script adn it should get traced too, i asked my friends for the same they told me it's possible but they also don't know the code.I have try to find it over internet but didn't got any proper solution for it. Can anyone help me out with this issue.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: How to get Mac Address using Php

    I am not sure will the following code will work to find out Mac address for you.

    PHP Code:
    <?php
    $browser 
    get_browser(nulltrue);
    print_r($browser);
    ?>
    where $browser['platform'] should hold the information.If you wan to trace Mac address of the user who visits you site you can also do it by using SMAC software. For downloading click here

  3. #3
    Join Date
    May 2008
    Posts
    2,389

    Re: How to get Mac Address using Php

    Use the following code to get the mac address

    PHP Code:
    // Get the arp executable path
    $location = `which arp`;
    // Execute the arp command and store the output in $arpTable
    $arpTable = `$location`;
    // Split the output so every line is an entry of the $arpSplitted array
    $arpSplitted split("\n",$arpTable);
    // Get the remote ip address (the ip address of the client, the browser)
    $remoteIp $GLOBALS['REMOTE_ADDR'];
    // Cicle the array to find the match with the remote ip address
    foreach ($arpSplitted as $value) {
    // Split every arp line, this is done in case the format of the arp
    // command output is a bit different than expected
    $valueSplitted split(" ",$value);
    foreach (
    $valueSplitted as $spLine) {
    if (
    preg_match("/$remoteIp/",$spLine)) {
    $ipFound true;
    }
    // The ip address has been found, now rescan all the string
    // to get the mac address
    if ($ipFound) {
    // Rescan all the string, in case the mac address, in the string
    // returned by arp, comes before the ip address
    // (you know, Murphy's laws)
    reset($valueSplitted);
    foreach (
    $valueSplitted as $spLine) {
    if (
    preg_match("/[0-9a-f][0-9a-f][:-]".
    "[0-9a-f][0-9a-f][:-]".
    "[0-9a-f][0-9a-f][:-]".
    "[0-9a-f][0-9a-f][:-]".
    "[0-9a-f][0-9a-f][:-]".
    "[0-9a-f][0-9a-f]/i",$spLine)) {
    return 
    $spLine;
    }
    }
    }
    $ipFound false;
    }
    }
    return 
    false;


Similar Threads

  1. Google chrome is not displaying the address in the address bar
    By Siketan in forum Technology & Internet
    Replies: 4
    Last Post: 23-03-2011, 04:13 AM
  2. Specific IP address changing TCP IPv4 DNS server address
    By Poks in forum Networking & Security
    Replies: 4
    Last Post: 11-01-2011, 06:05 AM
  3. Bypass Export address table Address Filter (EAF)
    By Dwarner in forum Software Development
    Replies: 4
    Last Post: 25-12-2010, 08:06 AM
  4. Replies: 2
    Last Post: 16-02-2009, 08:06 PM
  5. Adding new email address to exchange address book
    By RaeS in forum Small Business Server
    Replies: 5
    Last Post: 23-09-2008, 08:24 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,947,187.43718 seconds with 17 queries