iOS APNS Push-уведомления не получены для последних устройств
У меня есть приложение iOS с RSS-каналами, в нем есть служба push-уведомлений iOS, push-уведомления работают нормально для некоторых устройств (предыдущих устройств), но новые или последние устройства вообще не получают push-уведомления для этого приложения. Я думаю, что ошибка в моем php-скрипте, но я не знаю, как я могу ее решить, хост моего сайта, который подключается к моему приложению, - BlueHost.com.
Ошибка журнала:
[08-Aug-2013 11:00:14 America/Denver] PHP Warning: stream_socket_client(): unable to connect to ssl://gateway.push.apple.com:2195 (Unknown error) in /home3/basiphon/public_html/Push.php on line 56
[08-Aug-2013 11:15:24 America/Denver] PHP Warning: stream_socket_client(): SSL: crypto enabling timeout in /home3/basiphon/public_html/Push.php on line 56
[08-Aug-2013 11:15:24 America/Denver] PHP Warning: stream_socket_client(): Failed to enable crypto in /home3/basiphon/public_html/Push.php on line 56
[08-Aug-2013 11:15:24 America/Denver] PHP Warning: stream_socket_client(): unable to connect to ssl://gateway.push.apple.com:2195 (Unknown error) in /home3/basiphon/public_html/Push.php on line 56
[08-Aug-2013 11:30:33 America/Denver] PHP Warning: stream_socket_client(): unable to connect to ssl://gateway.push.apple.com:2195 (Connection timed out) in /home3/basiphon/public_html/Push.php on line 56
[08-Aug-2013 11:46:39 America/Denver] PHP Warning: stream_socket_client(): unable to connect to ssl://gateway.push.apple.com:2195 (Connection timed out) in /home3/basiphon/public_html/Push.php on line 56
Мой PHP скрипт
// Open a connection to the APNS server
$fp = stream_socket_client(
$url, $err,
$errstr, 2, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx);
if (!$fp)
exit("Failed to connect: $err $errstr" . PHP_EOL);
echo 'Connected to APNS' . PHP_EOL;
// Build the binary notification
$msg = chr(0) . pack('n', 32) . pack('H*', $deviceToken) . pack('n', strlen($payload)) . $payload;
// Send it to the server
$result = fwrite($fp, $msg, strlen($msg));
if (!$result)
echo 'Message not delivered' . PHP_EOL;
else
{
echo 'Message successfully delivered111' . PHP_EOL;
$query_update="update wp_apns_messages set status='delivered',delivery=NOW() where pid='$pid'";
$res_update=mysql_query($query_update) or die(mysql_error());
}
// Close the connection to the server
fclose($fp);
}
//echo "***";
?>
</body>
</html> </i>