Advertisement
AtomicOs

MAC ADRESS

Apr 24th, 2021
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.62 KB | None | 0 0
  1. <?php
  2.  
  3.   // PHP using CURL example
  4.  
  5.   $mac_address = "D4:B7:61:27:2B:9D";
  6.  
  7.   $url = "https://api.macvendors.com/v1/lookup/" . urlencode($mac_address);
  8.   $token = 'your token here';
  9.  
  10.   $ch = curl_init();
  11.   curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer '.$token]);
  12.   curl_setopt($ch, CURLOPT_URL, $url);
  13.   curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  14.   $response = curl_exec($ch);
  15.   $response = json_decode($response);
  16.  
  17.   if (empty($response)) {
  18.     echo "Not Found";
  19.   } elseif ($data = $response->data) {
  20.     var_dump($data);
  21.   } elseif ($errors = $response->errors) {
  22.     var_dump($errors);
  23.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement