Get MAC address
Results 1 to 6 of 6

Thread: Get MAC address

  1. #1
    Senior Member
    Join Date
    Jun 2000
    Posts
    65,357

    Get MAC address

    Anyone know of a function, or what the MAC address is stored in or how I can get it via the web. Either with PHP or any other means?

    Thanks.

  2. #2
    Senior Member
    Join Date
    Jun 2000
    Posts
    65,357

    RE: Get MAC address

    the unix and Dos command that let's you get a MAC address is arp.

    It works on *nix, NT, 9x, and just about any computer that supports TCP/IP.

    Here's how to use it on NT:

    C:\>arp /?

    Displays and modifies the IP-to-Physical address translation tables used by
    address resolution protocol (ARP).

    ARP -s inet_addr eth_addr [if_addr]
    ARP -d inet_addr [if_addr]
    ARP -a [inet_addr] [-N if_addr]

    -a Displays current ARP entries by interrogating the current
    protocol data. If inet_addr is specified, the IP and Physical
    addresses for only the specified computer are displayed. If
    more than one network interface uses ARP, entries for each ARP
    table are displayed.
    -g Same as -a.
    inet_addr Specifies an internet address.
    -N if_addr Displays the ARP entries for the network interface specified
    by if_addr.
    -d Deletes the host specified by inet_addr. inet_addr may be
    wildcarded with * to delete all hosts.
    -s Adds the host and associates the Internet address inet_addr
    with the Physical address eth_addr. The Physical address is
    given as 6 hexadecimal bytes separated by hyphens. The entry
    is permanent.
    eth_addr Specifies a physical address.
    if_addr If present, this specifies the Internet address of the
    interface whose address translation table should be modified.
    If not present, the first applicable interface will be used.
    Example:
    > arp -s 157.55.85.212 00-aa-00-62-c6-09 .... Adds a static entry.
    > arp -a .... Displays the arp table.

  3. #3
    Junior Member
    Join Date
    Mar 2002
    Posts
    8

    RE: Get MAC address

    i discover something from php under linux.
    ====================================
    <?

    function getMAC($ip) {
    exec("/usr/bin/ftp ".$ip);
    $mac = exec("/usr/sbin/arp -n");
    $arr = split(" ", $mac);
    return $arr[16];
    }

    echo getMAC($HTTP_X_FORWARDED_FOR);

    ?>

    ====================================
    when running the ftp program, the ip address and the mac address of the specified ip is being cached which can be accessed through arp program.

    but this code wont work the same way under windows environment. im looking for it soon.

  4. #4
    Junior Member
    Join Date
    Mar 2002
    Posts
    8

    RE: Get MAC address

    Just a follow up.

    <?

    function getMAC($ip) {
    exec("/usr/bin/ftp ".$ip);
    $mac = exec("/usr/sbin/arp -n");

    if (ereg("[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}:[0-9a-fA-F]{2}", $mac, $arr)) {
    return $arr[16];
    }

    return false;
    }

    echo getMAC($HTTP_X_FORWARDED_FOR);

    ?>

    i have seen that the mac address index would be dependent on the number of characters of the IP Address. to solve this problem i use the ereg function to test the specific mac address and then return or else return false if not found.

  5. #5
    Member
    Join Date
    Sep 2001
    Posts
    43

    RE: Get MAC address

    Hi

    Long time ago - but did you solve this problem. I want to do the same to find the MAC addess of computers on a network that are accessing my database..

    Cheers

    Paul

  6. #6
    Senior Member
    Join Date
    Jun 2000
    Posts
    65,357

    RE: Get MAC address

    I am trying to do that same thing? Any solutions?


    I am trying to get a list of all my client computers MAC-addresses for authentication purposes. I would like to be able to detect there MAC-Address automatically when they enter my website so that it could be sent to the database.
    Any Idea on how to do this using HTML or PHP or ...

    Any help would be much appreciated,
    fsys@faazmoe.com

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •