Skip to content

Instantly share code, notes, and snippets.

@vseow
Created August 7, 2015 22:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vseow/0ca934b60d27aba56792 to your computer and use it in GitHub Desktop.
Save vseow/0ca934b60d27aba56792 to your computer and use it in GitHub Desktop.
Update Beacon Info with PHP (Kontakt)
<?php
$url = 'https://api.kontakt.io/beacon/update?uniqueId=';
$prox = 'f7826da6-4fa2-4e98-8024-bc5b71e0893e'; // Example UUID
$did = 'lsuVg'; // Example Device ID, Unique ID
$alias = 'Example';
$privKey = 'insert-your-api-key-here';
$rest = curl_init();
// Only Unique ID required, rest optional and overwrites existing values - see http://docs.kontakt.io/rest-api/guide/#update-a-beacon
curl_setopt($rest, CURLOPT_URL, $url.$did."&alias=".$alias);
curl_setopt($rest, CURLOPT_RETURNTRANSFER, true);
curl_setopt($rest, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($rest,CURLOPT_HTTPHEADER,
array("Api-Key: ".$privKey,
"Accept: application/vnd.com.kontakt+json;version=5",
"Content-Type: application/x-www-form-urlencoded",
"User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.1 Safari/537.36"));
$response = curl_exec($rest);
echo $response;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment