Skip to content

Instantly share code, notes, and snippets.

@violetyk
Created August 27, 2013 13:17
Show Gist options
  • Save violetyk/6353393 to your computer and use it in GitHub Desktop.
Save violetyk/6353393 to your computer and use it in GitHub Desktop.
<?php
/*
* vi php.ini
* detect_unicode = Off
*
* vi composer.json
* {
* "require" :{
* "aws/aws-sdk-php": "2.4.3"
* },
* }
*
* curl -s http://getcomposer.org/installer | php
* php composer.phar install
*/
require_once(dirname(__FILE__) . '/composer/vendor/autoload.php');
use Aws\Common\Aws;
use Aws\Sns\SnsClient;
$sns = SnsClient::factory(array(
'key' => $key,
'secret' => $secret,
'region' => 'ap-northeast-1', // Tokyo
));
$model = $sns->listEndpointsByPlatformApplication(array('PlatformApplicationArn' => $app_arn));
try {
foreach ($model['Endpoints'] as $endpoint) {
$endpoint_arn = $endpoint['EndpointArn'];
print_r($endpoint_arn);
$sns->publish(array(
'Message' => 'うほ',
'TargetArn' => $endpoint_arn,
));
}
} catch (Exception $e) {
var_dump($e->getMessage());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment