sns推送api使用步骤

在linux下php sdk安装成功

 'XXXXXXX',
        'secret' => 'XXXXXXXX+XXXX',
        'region' => 'us-west-2'
    ));
    $client = $aws->get("Sns");
?>

一、发给单个用户推送消息

添加软件(上传证书,上一篇博客中有讲)createPlatformApplication  ------>>   添加终端createPlatformEndpoint      ------>>    获取终端编号发推送publish

//添加终端
$result = $client->createPlatformEndpoint(array(
    // PlatformApplicationArn is required
    'PlatformApplicationArn' => 'arn:aws:sns:us-west-2:579955374330:app/APNS/FightSmoke',
    'Token' => 'd02d84fcb73c86908ac8d4136a206bafd38ad922035a1d29c1c30c8a83d0a4eb',
    'CustomUserData' => 'string',
    'Attributes' => array(
        // Associative array of custom 'String' key names
        //'Enabled' => 'True',
        // ... repeated
    ),
));

//发送消息
$result = $client->publish(array(  
		'TargetArn' => $result['EndpointArn'],		
		'Message' => '您已成为健美宝典的会员'
	));

print_r($result);



二、发送多个终端。主题形式推送。

添加主题---推送

http://stackoverflow.com/questions/21557179/sending-amazon-sns-from-my-php-server


你可能感兴趣的:(亚马逊云AWS)