Amazon Simple Notification Service or SNS is a messaging service which be used to send notifications by SMS, Email, Push notification or to a URL endpoint.
For a quick on setting up Amazon SNS see this article Amazon SNS setup for HTTPS and Email
Code for auto confirmation of subscriptions
<?php $json_write_to_text = file_get_contents("php://input"); //read the raw data $json_write_to_text = json_decode($json_write_to_text, TRUE, 512, JSON_OBJECT_AS_ARRAY); if($json_write_to_text['Type'] == SubscriptionConfirmation) { $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => $json_write_to_text['SubscribeURL'], CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => $header, )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); } file_put_contents("response.txt",print_r($json_write_to_text,true)); // this is just for dumping the raw data and can be omitted ?>
3 thoughts on “PHP code for Amazon SNS Auto Subscription Confirmation (HTTPS)”