Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Finding nearest unfound caches with OKAPI
/* Enter your OKAPI's URL here. */
$okapi_base_url = "";
/* Enter your Consumer Key here. */
$consumer_key = "YOUR_KEY_HERE";
/* Caches found by this user will be EXCLUDED from the result. */
$username = "USERNAME_HERE";
/* Your location. */
$lat = 54.3;
$lon = 22.3;
/* 1. Get the UUID of the user. */
$json = @file_get_contents(
if (!$json)
die("ERROR! Check your consumer_key and/or username!\n");
$user_uuid = json_decode($json)->uuid;
print "Your UUID: ".$user_uuid."\n";
/* 2. Search for caches. */
$json = @file_get_contents(
if (!$json)
$cache_codes = json_decode($json)->results;
/* Display them. */
print "Five nearest unfound caches: ";
print implode(", ", $cache_codes)."\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.