In this tutorial, we will walk through the process of building a MAC Lookup Address application in PHP. This application will allow users to input a MAC address and retrieve information about the corresponding device, such as the manufacturer or vendor. We will leverage the MAC address API provided by MACaddress.io for this purpose.

Prerequisites

Before we begin, ensure you have the following prerequisites:

  1. PHP Installed: Make sure PHP is installed on your development machine. You can download it from php.net.
  2. Text Editor or Integrated Development Environment (IDE): Choose a text editor or IDE of your choice. Popular choices include Visual Studio Code, Sublime Text, or PHPStorm.
  3. MACaddress.io API Key: Sign up on MACaddress.io to obtain your API key.

MAC Lookup Online Tool

Please input a MAC address, OUI, or IAB below to search for the manufacturer, location, and additional details.

MAC Address Lookup in PHP: Quick Guide

  • Step 1: Setting up the Project

    Create a new directory on your web server for your MAC lookup tool project. Inside this directory, create two PHP files: index.php for the user interface and lookup.php for processing the MAC address lookup.

  • Step 2: Building the User Interface

    Add the following HTML form in index.php file. This HTML form creates the user interface for your tool, allowing users to input a MAC address for lookup.

    Copy to Clipboard
  • Step 3: Implementing the Lookup

    Create the lookup.php file to process the MAC address lookup and display the results.

    Copy to Clipboard

    In the above script:

    • We check if a MAC address has been submitted.
    • If provided, we format the MAC address by removing colons and converting it to uppercase.
    • We validate the MAC address format using a regular expression to ensure it consists of 12 hexadecimal characters.
    • If the MAC address is valid, we send a request to an external API (https://api.macvendors.com/) to fetch the manufacturer information based on the MAC address.
    • Finally, we display the MAC address and manufacturer information to the user.
  • Step 4: Testing the OUI & MAC Lookup Address

    • Ensure your web server is running and the project directory is accessible.
    • Open your web browser and navigate to the index.php file (e.g., http://localhost/mac-lookup-tool/index.php).
    • Enter a MAC address and click the “Lookup” button.

    Develop OUI & MAC Lookup Address in PHP: You should see the manufacturer information associated with the provided MAC address. Ensure that your server has internet access to connect to the API.