Skip to content

Instantly share code, notes, and snippets.

@bkilshaw
Created September 4, 2012 18:51
Show Gist options
  • Save bkilshaw/3624949 to your computer and use it in GitHub Desktop.
Save bkilshaw/3624949 to your computer and use it in GitHub Desktop.
MACVendors.com API :: PHP POST Example
<?php
$mac_address = "FC:FB:FB:01:FA:21";
$url = "http://api.macvendors.com/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "mac=$mac_address");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
if($response) {
echo "Vendor: $response";
} else {
echo "Not Found";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment