Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
75 lines (63 sloc) 2.48 KB
require_once 'kernel/EpiCurl.php';
require_once 'kernel/EpiFoursquare.php';
$clientId = 'a40b1aece83e8d94a08fff1e94f87c2f04af2881a';
$clientSecret = 'e83c621567e6c430848db6dc5dde94b9';
$redirectUri = '';
$userId = '5763863';
$fsObj = new EpiFoursquare($clientId, $clientSecret, $accessToken);
$fsObjUnAuth = new EpiFoursquare($clientId, $clientSecret);
<script type="text/javascript">
function viewSource() {
document.getElementById("source").style.display = "block";
<h1>Simple test to make sure everything works ok</h1>
<h2><a href="javascript:void(0);" onclick="viewSource();">View the source of this file</a></h2>
<div id="source" style="display:none; padding:5px; border: dotted 1px #bbb; background-color:#ddd;">
<?php highlight_file(__FILE__); ?>
<h2>Test an unauthenticated call to search for a venue</h2>
<?php $venue = $fsObjUnAuth->get('/venues/search', array('ll' => '40.7,-74')); ?>
<pre><?php var_dump($venue->response->groups[0]->items[0]); ?></pre>
<?php if(!isset($_GET['code']) && !isset($_COOKIE['access_token'])) { ?>
<h2>Generate the authorization link</h2>
<?php $authorizeUrl = $fsObjUnAuth->getAuthorizeUrl($redirectUri); ?>
<a href="<?php echo $authorizeUrl; ?>"><?php echo $authorizeUrl; ?></a>
<?php } else { ?>
<h2>Display your own badges</h2>
if(!isset($_COOKIE['access_token'])) {
$token = $fsObjUnAuth->getAccessToken($_GET['code'], $redirectUri);
setcookie('access_token', $token->access_token);
$_COOKIE['access_token'] = $token->access_token;
$badges = $fsObjUnAuth->get('/users/self/badges');
// Process the returned object and display the badge images
if (is_object($badges->response)) {
foreach ($badges->response->badges as $badge) {
echo "<img src=\"".$badge->image->prefix.$badge->image->sizes->{1}.$badge->image->name."\" title=\"".$badge->name."\" />";
<div style="height: 400px; overflow: auto; width: 100%; border: 2px solid #ccc;">
<pre><?php var_dump($badges->response); ?></pre>
<?php } ?>
<h2>Get a test user's checkins</h2>
$creds = $fsObj->get("/users/{$userId}/checkins");
<div style="height: 400px; overflow: auto; width: 100%; border: 2px solid #ccc;">
<?php var_dump($creds->response); ?>
Jump to Line
Something went wrong with that request. Please try again.