MAC vendor lookup: Difference between revisions
Content added Content deleted
m (added whitespace.) |
MaiconSoft (talk | contribs) (Added Delphi example) |
||
Line 287: | Line 287: | ||
(error "~%Not a MAC address: ~a" mac)))) |
(error "~%Not a MAC address: ~a" mac)))) |
||
</lang> |
</lang> |
||
=={{header|Delphi}}== |
|||
{{libheader| System.SysUtils}} |
|||
{{libheader| IdHttp}} |
|||
<lang Delphi> |
|||
program MAC_Vendor_Lookup; |
|||
{$APPTYPE CONSOLE} |
|||
uses |
|||
System.SysUtils, |
|||
IdHttp; |
|||
function macLookUp(mac: string): string; |
|||
begin |
|||
Result := ''; |
|||
with TIdHTTP.Create(nil) do |
|||
begin |
|||
try |
|||
Result := Get('http://api.macvendors.com/' + mac); |
|||
except |
|||
on E: Exception do |
|||
Writeln(e.Message); |
|||
end; |
|||
Free; |
|||
end; |
|||
end; |
|||
begin |
|||
Writeln(macLookUp('FC-A1-3E')); |
|||
sleep(1000); |
|||
Writeln(macLookUp('FC:FB:FB:01:FA:21')); |
|||
sleep(1000); |
|||
Writeln(macLookUp('BC:5F:F4')); |
|||
readln; |
|||
end.</lang> |
|||
{{out}} |
|||
<pre>Samsung Electronics Co.,Ltd |
|||
Cisco Systems, Inc |
|||
ASRock Incorporation</pre> |
|||
=={{header|Factor}}== |
=={{header|Factor}}== |