Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP script for Apple Push Notification FEEDBACK service gets TIMEOUT every time,
    primarykey
    data
    text
    <p>Greetings everyone! I'm currently implementing the Feedback service for Apples Push notifications. I've got the pushing part all done and working both on sandbox and on distribution apps. However the feedback service seems to not work.. Each time i try to use my function.. the page well.. just gets a timeout. </p> <p>I followed this answer to make my function : <a href="https://stackoverflow.com/questions/1278834/php-technique-to-query-the-apns-feedback-server/2298882#2298882">PHP technique to query the APNs Feedback Server</a></p> <p>Here is my full function code : </p> <pre><code>function checkFeedbackServer($appBundle,$useDev = TRUE) { $apnsPort = 2195; $apnsCert = keyForApp($appBundle,$useDev); if($useDev) { echo 'FEEDBACK in DEVELOPER MODE &lt;br/&gt;'; $apnsHost = 'feedback.sandbox.push.apple.com'; } else { echo 'FEEDBACK in DISTRIBUTION MODE &lt;br/&gt;'; $apnsHost = 'feedback.push.apple.com'; } $finalPath = 'ssl://' . $apnsHost . ':' . $apnsPort; echo 'OPENING STREAM TO -&gt; ' . $finalPath . '&lt;br/&gt;'; echo 'USING CERT : ' . $apnsCert . "&lt;br/&gt;"; $stream_context = stream_context_create(); stream_context_set_option($stream_context, 'ssl', 'local_cert', $apnsCert); $apns = stream_socket_client($finalPath, $error, $errorString, 2, STREAM_CLIENT_CONNECT, $stream_context); if(!$apns) { echo "ERROR $errcode: $errstr\n"; return; } else echo 'APNS FEEDBACK CONNECTION ESTABLISHED...&lt;br/&gt;'; $feedback_tokens = array(); $count = 0; echo 'error= ' . $error . '&lt;br/&gt;'; echo 'errorString= ' . $errorString . '&lt;br/&gt;'; if(!feof($apns)) echo 'APNS NOT FINISHED &lt;br/&gt;'; else echo 'APNS FINISHED? &lt;br/&gt;'; $result = fread($apns, 38); echo 'result= ' . $result; fclose($apns); } </code></pre> <p>I noticed that if i remove the lines : </p> <pre><code>$result = fread($apns, 38); echo 'result= ' . $result; </code></pre> <p>The function then works properly. So in a nuthsell I am able to open a connection to the feedback service both production and developer but as soon as I try to get any data from the server my script just times out..</p> <p>also the function <code>keyForApp($appBundle,$useDev)</code> is just a simple wrapper around a query to my database that fetches the correct certificate. I guarante it works since I am also using it while pushing messages to the device.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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