Amazon SNS Subscription verification with PHP

I've been trying to set up Amazon SES for my small group of subscribers, as I was done using Feedburner. Because we all know there not much option to manipulate email template, and worst, there is no API available to play with! So I decided to switch to low cost Amazon SES, which is exactly I need. I managed to create my own mailing system that sends emails using SES. But I was stuck with Amazon SNS (Simple Notification Service) verification process, because I was expecting normal POST variables from Amazon SNS, but it turns out Amazon puts subscribe confirmation link in PHP php://input along with other variables. So, in order to confirm subscription, we need to read php://input using listener script, and then it's up to you to decide what you want to do with the information. In my case I just emailed the content back to my email address, where I receive a subscribe URL included in this message, which takes me to a XML confirmation link to verify my subscription. Here's my code :
PHP
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
$msg_body =''; $msgs = json_decode(file_get_contents('php://input'), true); foreach($msgs as $msg) { $msg_body .= $msg." ----------\r\n\r\n"; } mail('[email protected]_site.com','Test token', $msg_body);
Below is the email received from my SNS listener script. amazon-subscription-link-email
    New question is currently disabled!