1
votes

I have created one http subscriber in My SNS console panel. I need to maintain the status of each email (bounce, complaints).

I have set up a publicly accessible http endpoint, created a subscription to my Topic, I click on the Subscribe button and the popup says "A confirmation message will be sent to the subscribed endpoint."

I just not understand how to verify my endpoint and collecting the post data from Amazon SNS.

I have put the endpoint url in below format.

http://example.com/amazon_sns/sns_notification.php

Endpoint will append all post data to a text file, when I request to endpoint from browser the data is written. Is something wrong I am doing.

I've been trying to subscribe for 1 days now, no luck. Any help much appreciated.

2

2 Answers

2
votes

NOTE: I'm assuming the problem is that your endpoint is not seeing any request. If that is not your problem please reply to me and update your question with what you problem is.

Here are some possibilities:

  1. You are using https with a self-signed cert (or a cert from a company which is not trusted by SNS) (https://forums.aws.amazon.com/thread.jspa?messageID=204271&#204271)
  2. You are listening on a port other than port 80 (for http), but have not specified the port to SNS
  3. Your ISP is blocking incoming connections on whatever port you are listening on
  4. You have a firewall blocking or router not forwarding connections on the port you are listening on.
  5. Something is wrong with your PHP

Some questions which would make it easier for me to help you:

  1. Where are you hosting the php (your house, EC2, a hosting service, etc.)
  2. Are you able to hit the php page from someone outside of where it is hosted?
1
votes

Put this in your sns_notification.php

You will then receive the body that is posted to the url in your email, in which the message from amazon will appear with a link to confirm your SNS topic subscription.

<?php

$headers = apache_request_headers();
$body = @file_get_contents('php://input');

mail("[email protected]", "ses callback", print_r($headers, 1)."\n---body---\n".$body);

?>