php - iPhone push notification on windows azure -


The following code is a work example which works fine under Linux server, but when I try the exact code in Azar If I do, I get a normal 500 internal server error.

All relative files have been uploaded correctly and I have configured php (php.ini) in Azure to use SSL.

Nobody knows why this valid code fails in Azure?

  & lt ;? Php Function Push On ($ DeviceToken, $ Message, $ Badge) {try $ $ body = array (); $ Body ['aps'] = array ('warning' = & gt; $ message); $ Body ['aps'] ['badge'] = $ badge; $ Body ['Aps'] ['sound'] = 'RMCF'; $ Ctx = stream_context_create (); Stream_context_set_option ($ ctx, 'ssl', 'local_cert', 'ck.pem'); $ Fp = stream_socket_client ('ssl: //gateway.sandbox.push.apple.com: 2195', $ err, $ errstr, 60, STREAM_CLIENT_CONNECT, $ ctx); // $ fp = stream_socket_client ('ssl: //gateway.push.apple.com: 2195', $ err, $ errstr, 60, STREAM_CLIENT_CONNECT, $ ctx); If (! $ FP) {return "$ err $ errstrn $ failed to connect"; } $ Payload = json_encode ($ body); $ Msg = chr (0) pack ("n", 32) pack ('h *', str_replace ('', '', $ deviceToken)). Pack ("n", strollon ($ payload)). $ Payload; FILIT ($ FP, $ msg); Fclose ($ FP); Return 'OK'; } Hold (exception $ E) {return 'exception:'. $ E & gt; GetMessage (); }} $ DeviceToken = '111111112222222233333333 44444444 55555555 66666666 77777777 88888888';   

PushOn ($ deviceToken, 'Hello World', '1'); Echo 'STOP' ;; & Gt;

Try to include it on top of your script:

  Error_Reporting (E_ALL); Ini_set ('display_errors', '1');   

This will show all php errors instead of 500 internal server errors.

Comments