无法从aws sns电子邮件退回通知消息中获取数据

时间:2016-06-26 23:44:26

标签: php amazon-web-services aws-sdk

我订阅了我的端点,现在我需要从对象/数组中提取emailAddress我无法获得值' fakeemail @     gmail.com'为了我的生命

Aws\Sns\Message Object
(
data:Aws\Sns\Message:private => Array
(
Type => Notification
MessageId => hghkvvhhv32hg32vh23v32hjk32bjk
TopicArn => arn:aws:sns:us-west-232jh32bhj322j3hv23jhv23jhv2
Message => {"notificationType":"Bounce","bounce":{"bounceType":"Permanent","bounceSubType":"Suppressed","bouncedRecipients":,"timestamp":"2016-06-21T04:43:05.786Z","feedbackId":"wef-a5166c3e-fe-11e6-923e4-1115qbdde1aq2907d-000000","reportingMTA":"dns; amazonses.com"},"mail":{"timestamp":"2016-06-21T04:43:04.000Z","source":"www-data@myserver.com","sourceArn":"arn:aws:ses:us-west-2:0f2243234320627162:identity/myserver.com","sendingAccountId":"0243122452162","messageId":"0103714433d74e-e3bfd2dd3b3b7-49238-45a3f-953fa-c9a3eb3fd312c-03300000","destination":["fakeemail@
gmail.com"]}}
Timestamp => 2016-06-21T04:43:05.882Z
SignatureVersion => 1
Signature => vfvdfvsdffsvfadvfdvdfvdfdfsdvsdfdf
SigningCertURL => https://sns.us-west-2.amazonaws.com/SimpleNotificationService-vafvadfvadsvdsfdsvsvdsdfsdvsdsvd.pem
UnsubscribeURL => https://sns.us-west-2.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-west-2:02vsddfvddv43230vfvsvf67162:email_bounce:5fc6vsdfvd6af9-cfssdvdv197-4vfsdf0f-afb7-67fvdfs1b
)
)

我已经改变了上面的细节,但这是给出的。我需要得到 来自对象阵列的fakeemail@gmail.com,但不能解决我的生活

//来自aws sdk

$message = Message::fromRawPostData();

我用过

print_r($message['Message'], true);

获取上述数据将不胜感激:)

1 个答案:

答案 0 :(得分:0)

好的我明白了。你想拿

$message['Message']

并将其编码为json以用作对象

$test = json_decode($message['Message']);
$returnsMyAnswer = print_r($test-> mail-> destination[0], true);

然后

echo $returnsMyAnswer;

你得到了

fakeemail@ gmail.com