简体   繁体   中英

How can i set a limit on Fousquare API

I'm fetching check-in's a place's from Foursquare API. But, API gets all check-in's. I need only 5 check-in's. How can I set a limit?

my code:

 <?php if(!isset($_GET['code']) && !isset($_COOKIE['access_token'])) { 

 $authorizeUrl = $fsObjUnAuth->getAuthorizeUrl($redirectUri); 

} else {}

$creds = $fsObj->get("/venues/{$userId}/herenow");

$f=0;
foreach ($creds->response->hereNow as $item) {}
foreach ($item as $item2) {
foreach ($item2 as $item3) {    
$f++;
if($item3->firstName) {

echo '<div class="user-normal">';
echo '<img src="'.$item3->photo.'" class="avatar" />';
echo '<span class="username-def">'; 
echo $item3->firstName; echo ' ';
echo $item3->lastName;
echo '</span>';
echo '</div>';
if ($f==5) break;

}

;};};     ?>

i try this apigee.com and is working http://prntscr.com/1phdin . apigee is creating oauth_token but I don't understand how. I get "invalid oauth_token" error because I can't create my own.

You can pass an optional parameter to set the limit

Foursquare Developer docs

So for example:

/venues/{$userId}/herenow?limit=5

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM