PHP code example of logocomune / maclookup

1. Go to this page and download the library: Download logocomune/maclookup 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/ */

    

logocomune / maclookup example snippets



bash
# Install Composer
curl -sS https://getcomposer.org/installer | php
bash
php composer.phar 
injectablephp

use MACLookup\MACLookupClient;



try {
    $responseMACInfo = $macLookupClient->getMacInfo("000000");
    var_export($responseMACInfo);
    //   MACLookup\Model\ResponseMACInfo::__set_state(array(
    //       'responseTime' => 204.819917678833,
    //       'rateLimit' =>
    //           MACLookup\Model\RateLimitModel::__set_state(array(
    //               'limit' => 2,
    //               'remainig' => 1,
    //               'reset' =>
    //                   DateTimeImmutable::__set_state(array(
    //                       'date' => '2020-10-16 14:36:38.000000',
    //                       'timezone_type' => 1,
    //                       'timezone' => '+00:00',
    //                   )),
    //           )),
    //       'macInfo' =>
    //           MACLookup\Model\MACInfoModel::__set_state(array(
    //               'success' => true,
    //               'found' => true,
    //               'macPrefix' => '000000',
    //               'company' => 'XEROX CORPORATION',
    //               'address' => 'M/S 105-50C, WEBSTER NY 14580, US',
    //               'country' => 'US',
    //               'blockStart' => '000000000000',
    //               'blockEnd' => '000000FFFFFF',
    //               'blockSize' => 16777215,
    //               'blockType' => 'MA-L',
    //               'updated' => '2015-11-17',
    //               'isRand' => false,
    //               'isPrivate' => false,
    //           )),
    //   ))
} catch (APIKeyException $e) {
    //Bad API Key HTTP status code 401
} catch (ClientException $e) {
    //Client error  HTTP status code 4xx (no 401 and 429)
} catch (HTTPRequestException $e) {
    //Network error
} catch (ServerException $e) {
    //Server error HTTP status code 5xx
} catch (TooManyRequestException $e) {
    //Too Many Request HTTP status code 429
}

try {
    $companyName = $macLookupClient->getCompanyName("000000");
    var_export($companyName);
    //  MACLookup\Model\ResponseVendorInfo::__set_state(array(
    //     'responseTime' => 292.59610176086426,
    //     'rateLimit' => 
    //    MACLookup\Model\RateLimitModel::__set_state(array(
    //       'limit' => 2,
    //       'remainig' => 1,
    //       'reset' => 
    //      DateTimeImmutable::__set_state(array(
    //         'date' => '2020-10-16 14:41:08.000000',
    //         'timezone_type' => 1,
    //         'timezone' => '+00:00',
    //      )),
    //    )),
    //     'vendorInfo' => 
    //    MACLookup\Model\VendorInfoModel::__set_state(array(
    //       'found' => true,
    //       'private' => false,
    //       'company' => 'XEROX CORPORATION',
    //    )),
    //  ))
} catch (APIKeyException $e) {
    //Bad API Key HTTP status code 401
} catch (ClientException $e) {
    //Client error  HTTP status code 4xx (no 401 and 429)
} catch (HTTPRequestException $e) {
    //Network error
} catch (ServerException $e) {
    //Server error HTTP status code 5xx
} catch (TooManyRequestException $e) {
    //Too Many Request HTTP status code 429
}