Created
February 27, 2015 00:08
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice piece of code, thank you!