PHP code example of codelinefi / mac-lookup

1. Go to this page and download the library: Download codelinefi/mac-lookup library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

codelinefi / mac-lookup example snippets






use CodeLine\MacLookup\Builders\ClientBuilder;

$builder = new ClientBuilder();
$client = $builder->build('Your API key');

echo $client->get('F041C81')->blockDetails->dateUpdated . PHP_EOL;
echo $client->getRawData('18810E') . PHP_EOL;
echo $client->getVendorName('F041C81') . PHP_EOL;



use CodeLine\MacLookup\Builders\ResponseModelBuilder;
use CodeLine\MacLookup\Clients\GuzzleClient;
use CodeLine\MacLookup\ApiClient;
use \GuzzleHttp\Client;

$requestor = new GuzzleClient(new Client());
$builder = new ResponseModelBuilder('');
$client = new ApiClient($requestor, $builder, 'Your API key');

echo $client->get('18810E')->vendorDetails->companyName . PHP_EOL;
echo $client->getRawData('18810E') . PHP_EOL;
echo $client->getVendorName('18810E') . PHP_EOL;

/**
 * ApiClient constructor.
 * @param \CodeLine\MacLookup\Clients\ClientInterface $client
 * @param \CodeLine\MacLookup\Builders\ResponseModelBuilderInterface $builder
 * @param string $apiKey Your API key
 * @param string $url API base URl
*/
public function __construct(
    ClientInterface $client,
    ResponseModelBuilderInterface $builder,
    $apiKey,
    $url = ""
)

/**
 * @param string $url API base URl
 */
public function setBaseUrl($url);

/**
 * @param string $apiKey Your API key
 */
public function setApiKey($apiKey);

/**
 * @param string $mac Mac address or OUI
 * @return \CodeLine\MacLookup\Models\Response
 * @throws EmptyResponseException
 * @throws ServerErrorException
 * @throws UnknownOutputFormatException
 * @throws AuthorizationRequiredException
 * @throws NotEnoughCreditsException
 * @throws AccessDeniedException
 * @throws InvalidMacOrOUIException
 */
public function get($mac);

/**
 * @param string $mac Mac address or OUI
 * @param string $format Supported formats json/xml/csv/vendor
 * @return string
 * @throws EmptyResponseException
 * @throws ServerErrorException
 * @throws UnknownOutputFormatException
 * @throws AuthorizationRequiredException
 * @throws NotEnoughCreditsException
 * @throws AccessDeniedException
 * @throws InvalidMacOrOUIException
 */
public function getRawData($mac, $format = 'json');

/**
 * @param string $mac Mac address or OUI
 * @return string
 * @throws ServerErrorException
 * @throws UnknownOutputFormatException
 * @throws AuthorizationRequiredException
 * @throws NotEnoughCreditsException
 * @throws AccessDeniedException
 * @throws InvalidMacOrOUIException
*/
public function getVendorName($mac);

/**
 * @var VendorDetails
 */
public $vendorDetails;

/**
 * @var BlockDetails
 */
public $blockDetails;

/**
 * @var MacAddressDetails
 */
public $macAddressDetails;

/**
 * @var string
 */
public $oui;

/**
 * @var boolean
 */
public $isPrivate;

/**
 * @var string
 */
public $companyName;

/**
 * @var string
 */
public $companyAddress;

/**
 * @var string
 */
public $countryCode;

/**
 * @var boolean
 */
public $blockFound;

/**
 * @var string
 */
public $borderLeft;

/**
 * @var string
 */
public $borderRight;

/**
 * @var int|float
 */
public $blockSize;

/**
 * @var string
 */
public $assignmentBlockSize;

/**
 * @var \DateTimeInterface
 */
public $dateCreated;

/**
 * @var \DateTimeInterface
 */
public $dateUpdated;

/**
 * @var string
 */
public $searchTerm;

/**
 * @var boolean
 */
public $isValid;

/**
 * @var string
 */
public $transmissionType;

/**
 * @var string
 */
public $administrationType;

/**
 * @param string $apiKey
 * @param string $url
 * @return \CodeLine\MacLookup\ApiClient
 */
public function build($apiKey, $url = '');
bash
export API_KEY="<Your api key>"
php vendor.php
php basic.php
bash
git clone https://github.com/CodeLineFi/maclookup-php.git