public function testCheckin()
 {
     $foursquare = new FoursquareApi(CLIENT_ID, CLIENT_SECRET);
     $foursquare->SetAccessToken(TOKEN);
     // Checks the acting user in at Aux Vivres in Montreal, Canada
     $response = json_decode($foursquare->GetPrivate("checkins/add", array("venueId" => "4ad4c06bf964a5207ff920e3"), $POST = true));
     $this->assertLessThan(400, $response->meta->code, $response->meta->errorDetail);
 }
예제 #2
0
    <input type="submit" value="Search!"/>
</form>
<p>Searching for users with name similar to <?php 
echo $name;
?>
</p>
<hr/>
<?php 
// Set your client key and secret
$client_key = "<your client key>";
$client_secret = "<your client secret>";
// Set your auth token, loaded using the workflow described in tokenrequest.php
$auth_token = "<your auth token>";
// Load the Foursquare API library
$foursquare = new FoursquareApi($client_key, $client_secret);
$foursquare->SetAccessToken($auth_token);
// Prepare parameters
$params = ["name" => $name];
// Perform a request to a authenticated-only resource
$response = $foursquare->GetPrivate("users/search", $params);
$users = json_decode($response);
// NOTE:
// Foursquare only allows for 500 api requests/hr for a given client (meaning the below code would be
// a very inefficient use of your api calls on a production application). It would be a better idea in
// this scenario to have a caching layer for user details and only request the details of users that
// you have not yet seen. Alternatively, several client keys could be tried in a round-robin pattern
// to increase your allowed requests.
?>
<ul>
    <?php 
foreach ($users->response->results as $user) {