2014-01-23 20 views
3

我试图处理Mandrill的webhook数据时,我得到一个反弹我想让Mandrill告诉我的应用程序它是哪个电子邮件并将各种数据保存在MySql数据库中。处理Mandrill Webhook数据

我在这里使用PHP,根据Mandrill他们发送一个URL,我给他们一个带有JSON数据的$ _POST请求。

通常我会json_decode()这个请求,但是当我这样做的时候,它看起来是空白的。对我来说,JSON看起来格式不正确,但也许我需要先用它做点什么?

这是我收到我的脚本:

[mandrill_events] => 
[{\"event\":\"hard_bounce\",\"msg\":{\"ts\":1365109999,\"subject\":\"This an example webhook message\",\"email\":\"[email protected]\",\"sender\":\"[email protected]\",\"tags\":[\"webhook-example\"],\"state\":\"bounced\",\"metadata\":{\"user_id\":111},\"_id\":\"exampleaaaaaaaaaaaaaaaaaaaaaaaaa\",\"_version\":\"exampleaaaaaaaaaaaaaaa\",\"bounce_description\":\"bad_mailbox\",\"bgtools_code\":10,\"diag\":\"smtp;550 5.1.1 The email account that you tried to reach does not exist. Please try double-checking the recipient\'s email address for typos or unnecessary spaces.\"},\"_id\":\"exampleaaaaaaaaaaaaaaaaaaaaaaaaa\",\"ts\":1390483382},{\"event\":\"soft_bounce\",\"msg\":{\"ts\":1365109999,\"subject\":\"This an example webhook message\",\"email\":\"[email protected]\",\"sender\":\"[email protected]\",\"tags\":[\"webhook-example\"],\"state\":\"soft-bounced\",\"metadata\":{\"user_id\":111},\"_id\":\"exampleaaaaaaaaaaaaaaaaaaaaaaaaa1\",\"_version\":\"exampleaaaaaaaaaaaaaaa\",\"bounce_description\":\"mailbox_full\",\"bgtools_code\":22,\"diag\":\"smtp;552 5.2.2 Over Quota\"},\"_id\":\"exampleaaaaaaaaaaaaaaaaaaaaaaaaa1\",\"ts\":1390483382}] 
+1

试图通过我们的工具运行为:https:/ /www.runscope.com/docs/request-capture –

回答