title: Push notifications in PHP using Amazon SNS/SQS?
body: <p>On my site I'd like to do push notifications of comments like Stackoverflow does. Amazon SNS/SQS seems to provide a framework to do this but I'm having difficulty finding any code/explanation on the web for anything beyond a "hello world" equivalent.</p>
  
  <p>From reading the AWS SNS/SQS documentation it looks like I need the following:</p>
  
  <p>logic:</p>
  
  <ol>
  <li>post comment/answer to a new question</li>
  <li>create topic (for first comment/answer only)</li>
  <li>publish message</li>
  <li>subscribe to topic</li>
  </ol>
  
  <p>PHP on the page where comments are posted (http://mysite.com/postCommentOrAnswer.php):</p>
  
  <pre><code>$comment=$_POST['comment']; //posted comment
  require_once 'application/third_party/AWSSDKforPHP/sdk.class.php';
  $sns = new AmazonSNS();
  
  $response = $sns-&gt;create_topic('SO-like-question-12374940'); //create topic
  
  $response = $sns-&gt;publish(
    'arn:aws:sns:us-east-1:9876543210:SO-like-question-12374940',
    $comment
  );  //publish comment
  
  $response = $sns-&gt;subscribe(
    'arn:aws:sns:us-east-1:9876543210:SO-like-question-12374940',
    'https ',
    'https://mysite.com/notificationsReceiver'
  ); // Subscribe to notifications
  </code></pre>
  
  <p>PHP on the page where notifications are received (http://mysite.com/notificationsReceiver.php):</p>
  
  <pre><code>no idea, thoughts?
  </code></pre>
  
  <p>Obviously, this is not close to being a complete demonstration and probably has some incorrect function calls but I was wondering if someone might be able to help build upon this?</p>