Skip to content
Rob W edited this page Mar 21, 2015 · 1 revision

How to use the pagination method

Using the do-while loop, you can easily implement the pagination method on most API calls.

Examples

Get all users that user X follows:

$Instagram = new MetzWeb\Instagram\Instagram(array(
    "apiKey"      => IG_APP_KEY,
    "apiSecret"   => IG_APP_SECRET,
    "apiCallback" => IG_APP_CALLBACK
));
$Instagram->setSignedHeader(true);

$followers = $Instagram->getUserFollows(123);
do {
  // Process this batch of $followers
  // <do something>

  // Don't forget this pagination method or this will become an infinite loop!
  $followers = $Instagram->pagination($followers);
} while ($followers);
Clone this wiki locally