Ejemplo n.º 1
0
}
$oauth_token = $_GET['oauth_token'];
if (!empty($oauth_token)) {
    session_start();
    $foursquareObj = new EpiFoursquare($consumer_key, $consumer_secret);
    $foursquareObj->setToken($_REQUEST['oauth_token'], $_SESSION['secret']);
    $token = $foursquareObj->getAccessToken();
    $foursquareObj->setToken($token->oauth_token, $token->oauth_token_secret);
    try {
        //Making a call to the API
        $foursquareTest = $foursquareObj->get_user();
        $userSettings = new goUserSettings();
        $responseUserArray = $foursquareTest->response['user'];
        $fquserID = $responseUserArray['id'];
        $fqphoto = $responseUserArray['photo'];
        $userSettings->updateFoursquareOAuth(1, $fquserID, $fqphoto, $token->oauth_token, $token->oauth_token_secret);
        print_r($foursquareTest->response);
        echo 'working with array';
        $a = $foursquareTest->response['user'];
        echo "user id " . $a['id'];
    } catch (Exception $e) {
        echo "Error: " . $e;
    }
    header("Location:http://jittr.com/jittr/gameon");
}
/*
echo "<a href='" . $loginurl . "'>Login Via Foursquare</a>";  //Display the Foursquare login link
echo "<br>";
//This is your OAuth token and secret generated above
//The OAuth token is part of the Foursquare link above
//They are dynamic and will change each time you refresh the page