title: Apple Production Push Service is not working!
body: <p>Please, help me! I've tried intensely to find the answer to my problem but I was unsuccessful all the time.</p>
  
  <p>I've implemented the Development Push Notification successfully for my app, but when submitted the app and updated the code to the Production service I can't send the push notification.
  I have no errors on sending at all, but the push notifications are not being received by the registered devices. </p>
  
  <p>The php code for in my server is something like this:</p>
  
  <p></p>
  
  <pre><code>$streamContext = stream_context_create();
  
  stream_context_set_option($streamContext, 'ssl', 'local_cert', 'apns-dev.pem');
  
  $apns = stream_socket_client('ssl://gateway.push.apple.com:2195', $error, $errorString, 15, STREAM_CLIENT_CONNECT, $streamContext);
  
  if (!$apns)
  {
  echo "ERROR";
  } else 
  {
      if ($error)
      {
          echo "ERROR: " . $error . ": " . $errorString;
      } 
      else
      {
          echo "&lt;p&gt; Processing....&lt;/p&gt;&lt;br /&gt;";
          $inputMessage = utf8_encode($_POST['text']);
          echo "&lt;p&gt;MESSAGE: $inputMessage&lt;/p&gt;";
          $payload['aps'] = array('alert' =&gt; $inputMessage, 'sound' =&gt; 'default');
  
          $payload = json_encode($payload);
  
          $apnsMessagePart1 = chr(0) . chr(0) . chr(32);
          $apnsMessagePart3 = chr(0) . chr(strlen($payload)) . $payload;
  
          $xml = simplexml_load_file("tokens.xml");   
  
          if ($xml != NULL) {
              $devicesCount = 0;
              foreach($xml-&gt;children() as $deviceToken)
              {
                  echo "&lt;p&gt;processando aparelho com o token: $deviceToken&lt;/p&gt;";
                  $apnsMessagePart2 = pack('H*', str_replace(' ', '', $deviceToken));
                  $apnsMessage = $apnsMessagePart1 . $apnsMessagePart2 . $apnsMessagePart3;
                  $success = fwrite($apns, $apnsMessage);
                  if (!$success)
                      echo "Error sending message to $deviceToken";
                  else
                      $devicesCount++;
              }
              socket_close($apns);
              fclose($apns);
              echo "&lt;h2&gt;... done!&lt;/h2&gt;";
          }
          else
          {
              echo "&lt;h4&gt;error: no xml file found!&lt;/h4&gt;";
          }
      }
  }
  </code></pre>
  
  <p></p>