title: PHP Apple Enhanced Push Notification read error response
body: <p>In PHP, how do you use fread() to check if there is an error response when sending enhanced push notifications?</p>
  <p>I have read the Apple docs, a couple vague posts thru Google, and a couple questions/answers here on SO but this was still very confusing.</p>
  <p>Here is what I looked at:
  <a href="http://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/IPhoneOSClientImp/IPhoneOSClientImp.html" rel="nofollow noreferrer">http://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/IPhoneOSClientImp/IPhoneOSClientImp.html</a>
  <a href="https://stackoverflow.com/questions/6665921/reading-error-from-apple-enhanced-push-notification-with-php">Reading error from Apple enhanced push notification with PHP</a>
  <a href="https://stackoverflow.com/questions/4034926/iphone-push-notification-error-response-problem">iPhone Push Notification - Error response problem</a></p>
  <p>I am going to answer my own question below, based on the fact that: (1) I found this a very confusing topic, and (2) I had to piece the information together with lots of trial and error to get it to work, and (3) this blog post that says it is encouraged: <a href="https://blog.stackoverflow.com/2011/07/its-ok-to-ask-and-answer-your-own-questions/">https://blog.stackoverflow.com/2011/07/its-ok-to-ask-and-answer-your-own-questions/</a></p>