abhij89
abhij89

Reputation: 625

Unable to receive confirm subscription request

Hi i am not able to receive the confirm subscription request from Amazon, tried everything. My endpoint url is: http://example.com/test/test. I have tried following snippets of code to receive response: 1) ->

$headers = apache_request_headers();
$body = @file_get_contents('php://input');
file_put_contents(Path to file."json_sns.txt", serialize(print_r($headers, 1)."\n---body---\n".$body));

2) ->

$h= fopen("php://input","r");
$X = stream_get_contents($h);
$J = json_decode( $X , true);
file_put_contents(Path to file."json_sns.txt", serialize(print_r($headers, 1)."\n---body---\n".$body));

3) ->

file_put_contents(Path to file."json_sns.txt", serialize($_POST));

and many more, yet no success. Verified that the endpoint url is accessible through browser. Subscription is there in sns console with pending confirmation status.

Please help me how to receive the response from amazon, also point out if i have done something wrong in my code or i have missed out any step. Thanks.

Upvotes: 0

Views: 290

Answers (1)

abhij89
abhij89

Reputation: 625

Resolved the issue, actually CSRF token was causing the problem, due to which Amazon request wasn't completing, added a exception for its request, and then it worked like a charm. :)

Upvotes: 2

Related Questions