<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/keychain.php";
$foursquareID = $_GET["id"];
$keychain = new keychain();
$clientID = $keychain->getInstagramClientId();
$curl = curl_init();
// Set some options
curl_setopt_array($curl, array(CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => "https://api.instagram.com/v1/locations/search?foursquare_v2_id={$foursquareID}&client_id={$clientID}"));
$responce = curl_exec($curl);
curl_close($curl);
echo $responce;
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/keychain.php";
$latitude = $_GET["lat"];
$longitude = $_GET["lng"];
$keychain = new keychain();
$token = $keychain->getFoursquareToken();
$curl = curl_init();
// Set some options - we are passing in a useragent too here
curl_setopt_array($curl, array(CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => "https://api.foursquare.com/v2/venues/search?ll={$latitude},{$longitude}&oauth_token={$token}"));
$responce = curl_exec($curl);
curl_close($curl);
echo $responce;