The MAC Address Vendor search API allows you to make queries via our database and fetch information about any MAC address.
This is very simple HTTP GET request and its easily to integrate into your software.
Examples
Raw URL request:
http://searchmac.com/api/v2/MAC_ADDRESS
Simple PHP class:
Examples
Raw URL request:
http://searchmac.com/api/v2/MAC_ADDRESS
Simple PHP class:
<?php
class SearchMac {
const URL = 'http://searchmac.com/api/v2/';
protected $emptyNotice = 'Empty data received';
protected $formatNotice = 'Wrong MAC format';
/**
* Checks is MAC address valid?
*
* @param string $mac target mac address
*
* @return bool
*/
protected function checkMacFormat($mac) {
$mask = '/^[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}:[a-f0-9]{2}$/i';
if (preg_match($mask, $mac)) {
return (true);
} else {
return (false);
}
}
/**
* Returns vendor/manufacturer name by mac address
*
* @param string $mac mac address for vendor search
*
* @return string
*/
public function lookup($mac) {
if ($this->checkMacFormat($mac)) {
$rawdata = file_get_contents(self::URL . $mac);
if (!empty($rawdata)) {
$result = $rawdata;
} else {
$result = $this->emptyNotice;
}
} else {
$result = $this->formatNotice;
}
return ($result);
}
}
/*
* Example of usage
*/
$mac='e8:ba:70:c6:49:fa';
$look = new SearchMac();
$vendor=$look->lookup($mac);
print($vendor);
?>