Answers for "how to confirm sns subscription https php"

PHP
0

how to confirm sns subscription https php

<?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 
?>
Posted by: Guest on January-22-2021

Browse Popular Code Answers by Language