{"id":615,"date":"2019-01-11T10:40:24","date_gmt":"2019-01-11T10:40:24","guid":{"rendered":"https:\/\/www.kolkataonweb.com\/code-bank\/?p=615"},"modified":"2019-01-11T10:41:31","modified_gmt":"2019-01-11T10:41:31","slug":"php-code-for-amazon-sns-auto-subscription-confirmation-https","status":"publish","type":"post","link":"https:\/\/www.kolkataonweb.com\/code-bank\/miscellaneous\/php-code-for-amazon-sns-auto-subscription-confirmation-https\/","title":{"rendered":"PHP code for Amazon SNS Auto Subscription Confirmation (HTTPS)"},"content":{"rendered":"<p>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.<\/p>\n<p>For a quick on setting up Amazon SNS see this article <a href=\"https:\/\/www.kolkataonweb.com\/code-bank\/miscellaneous\/amazon-sns-setup-for-https-and-email\/\">Amazon SNS setup for HTTPS and Email<\/a><\/p>\n<p>Code for auto confirmation of subscriptions<\/p>\n<pre class='wp-code-highlight prettyprint'>&lt;?php\r\n$json_write_to_text = file_get_contents(\"php:\/\/input\"); \/\/read the raw data \r\n$json_write_to_text = json_decode($json_write_to_text, TRUE, 512, JSON_OBJECT_AS_ARRAY);\r\n\r\nif($json_write_to_text['Type'] == SubscriptionConfirmation)\r\n{\r\n $curl = curl_init();\r\n\r\n curl_setopt_array($curl, array(\r\n  CURLOPT_URL =&gt; $json_write_to_text['SubscribeURL'],\r\n  CURLOPT_RETURNTRANSFER =&gt; true,\r\n  CURLOPT_CUSTOMREQUEST =&gt; \"GET\",\r\n  CURLOPT_HTTPHEADER =&gt; $header,\r\n ));\r\n\r\n $response = curl_exec($curl);\r\n $err = curl_error($curl);\r\n\r\n curl_close($curl);\r\n}\r\n\r\nfile_put_contents(\"response.txt\",print_r($json_write_to_text,true)); \/\/ this is just for dumping the raw data and can be omitted \r\n?&gt;<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &lt;?php $json_write_to_text = file_get_contents(&#8220;php:\/\/input&#8221;); \/\/read&hellip; <a class=\"more-link\" href=\"https:\/\/www.kolkataonweb.com\/code-bank\/miscellaneous\/php-code-for-amazon-sns-auto-subscription-confirmation-https\/\">Continue reading <span class=\"screen-reader-text\">PHP code for Amazon SNS Auto Subscription Confirmation (HTTPS)<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,3],"tags":[147,146,141,148,149],"class_list":["post-615","post","type-post","status-publish","format-standard","hentry","category-miscellaneous","category-php","tag-amazon-aws","tag-amazon-sns","tag-php","tag-simple-notification-services","tag-sns","entry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/posts\/615","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/comments?post=615"}],"version-history":[{"count":1,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/posts\/615\/revisions"}],"predecessor-version":[{"id":622,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/posts\/615\/revisions\/622"}],"wp:attachment":[{"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/media?parent=615"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/categories?post=615"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/tags?post=615"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}