无法连接到ssl://gateway.push.apple.com:2195(未知错误)

时间:2016-04-12 23:32:16

标签: php ios push-notification apple-push-notifications

我对苹果推送服务有疑问。 以下警告究竟意味着什么?

  

警告:stream_socket_client():无法在第150行的/opt/../xyz.php中启用加密

     

警告:stream_socket_client():无法连接到第150行的/opt/../xyz.php中的ssl://gateway.push.apple.com:2195(未知错误)

我正在使用大约5个不同的php文件将推送(ChatMessagePushfunction sendPush($deviceToken, $msg) { $deviceToken = $deviceToken; $passphrase = 'passhrase'; $ctx = stream_context_create(); stream_context_set_option($ctx, 'ssl', 'local_cert', 'Production.pem'); stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase); $fp = stream_socket_client( 'ssl://gateway.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx); if (!$fp) { unset($con); exit(); } //do the other stuff //Close the connection to the server fclose($fp); } ...)发送到iOS设备,它们工作正常。但有时候我会收到这些警告并且我不知道它们的意思,但是当我收到这些警告时,推动并不起作用。

我知道如果您的pem文件错误或端口2195被阻止,它们就会出现。但推动有时会起作用,有时它并不起作用。所以pem文件必须正确,端口不能被阻止。

我知道推送5个不同的脚本并不好,我会很快改变它。

你知道发生了什么吗?

我的php脚本如下所示:

for(int i = 0; i < 25; i++){
    double array[i] = array[0] * array[0];
}

0 个答案:

没有答案