Skip to content

Instantly share code, notes, and snippets.

@scottopolis
Created February 27, 2015 00:08
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottopolis/df0e42b02c39564dc21b to your computer and use it in GitHub Desktop.
Save scottopolis/df0e42b02c39564dc21b to your computer and use it in GitHub Desktop.
How to use the AWS NextToken in PHP. This is for Amazon SNS specifically.
do {
// We only get 100 subscribers, if there's a nextToken, get the next 100
if( $nextToken ) {
$result = $client->listEndpointsByPlatformApplication(array(
'PlatformApplicationArn' => $gcm_arn,
'NextToken' => $nextToken
));
} else {
// Run this the first time, since there's no nextToken yet
$result = $client->listEndpointsByPlatformApplication(array(
'PlatformApplicationArn' => $gcm_arn
));
}
$nextToken = $result['NextToken'];
} while( $nextToken );
@SmokinB
Copy link

SmokinB commented Sep 26, 2022

Nice piece of code, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment