MAC vendor lookup: Difference between revisions

No edit summary
Line 569:
Roku, Inc.
N/A
</pre>
 
=={{header|Phix}}==
<lang Phix>string test = "00-11-22-33-44-55-66" -- CIMSYS Inc
--string test = "10-11-22-33-44-55-66" -- N/A
include builtins/libcurl.e
curl_global_init()
atom curl = curl_easy_init()
string url = sprintf("http://api.macvendors.com/%s",{test})
curl_easy_setopt(curl, CURLOPT_URL, url)
object res = curl_easy_perform_ex(curl)
if string(res) then
if res="Vendor not found"
or res=`{"errors":{"detail":"Not Found"}}` then
res = "N/A"
end if
?res
else
?{"error",res}
end if
curl_easy_cleanup(curl)
curl_global_cleanup()</lang>
{{out}}
<pre>
CIMSYS Inc
</pre>
 
7,820

edits