Note that there are some explanatory texts on larger screens.

plurals
  1. POEnhanced Apple Push Notification: Response error at provider server
    text
    copied!<p>i am working on a project in PHP which requires me to push an alert notification on APNS server. I have used enhanced push notification format. but I am not receiving response as specified by the APNS docs. I am getting response in three digits usually 133, 132, 154, 138, etc. Which I concluded to be Status signs, eg. 133 is 1, 3, 3. but now I have also received 139. so I doubt that my interpretation of response is wrong. But I am not getting where it is wrong. And important thing is though I am receiving these responses Alert is getting pushed and I am receiving notification on my iPhone as well as on iPad.</p> <p>My code is as follows:</p> <pre><code>$payload['aps'] = array('alert' =&gt; $message, 'badge' =&gt; 1, 'sound' =&gt; 'default'); $apnsHost = 'gateway.sandbox.push.apple.com'; $apnsPort = 2195; // default port $apnsCert = 'apns-dev.pem'; // APNS crtificate. $passPhrase = ''; $streamContext = stream_context_create(); stream_context_set_option($streamContext, 'ssl', 'local_cert', $apnsCert); stream_context_set_option($streamContext, 'ssl', 'passphrase', $passPhrase); try{ $apns = stream_socket_client('ssl://' . $apnsHost . ':' . $apnsPort, $error, $errorString, 60, STREAM_CLIENT_CONNECT, $streamContext); if (!$apns) { print "Failed to connect {$error} {$errorString}\n"; } else { // Sending the payload $apnsMessage = chr(0) . pack('n', 1) . pack('n', $nid) . pack('n', time() + 604800) . pack('n', 32) . pack('H*', str_replace(' ', '', $alert_device_token)) . pack('n', strlen($payload)) . $payload; echo 'APNS Message: ' . $apnsMessage; $fwrite = fwrite($apns, $apnsMessage); echo 'APNS response: ' . $fwrite; </code></pre> <p>And when this get executed i got the following response printed on the browser:</p> <blockquote> <p>APNS Message: ��=ŸÂ� òc6–U:õŸŠ ¸Þ ÷ćÚ0ßqšÊzÂífÕnZ�`{"aps":{"alert":"Your EUR\/USD SELL alert price has been reached!","badge":1,"sound":"default"}}APNS response: 139</p> </blockquote> <p>Can anyone please tell me what does this 139 means here. am doing anything wrong here.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload