ApnsPHP无法连接到Apple Gateway

Tim*_*cht 13 php apple-push-notifications

突然间,今天出现了一个非常奇怪的错误,说它无法连接到相应的网关...任何修复建议?

这是记录器输出:

Wed, 08 Jun 2011 15:05:44 +0200 ApnsPHP[21724]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195...
Wed, 08 Jun 2011 15:05:45 +0200 ApnsPHP[21724]: ERROR: Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195':  (0)
Wed, 08 Jun 2011 15:05:45 +0200 ApnsPHP[21724]: INFO: Retry to connect (1/3)...
Wed, 08 Jun 2011 15:05:46 +0200 ApnsPHP[21724]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195...
Wed, 08 Jun 2011 15:05:47 +0200 ApnsPHP[21724]: ERROR: Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195':  (0)
Wed, 08 Jun 2011 15:05:47 +0200 ApnsPHP[21724]: INFO: Retry to connect (2/3)...
Wed, 08 Jun 2011 15:05:48 +0200 ApnsPHP[21724]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195...
Wed, 08 Jun 2011 15:05:48 +0200 ApnsPHP[21724]: ERROR: Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195':  (0)
Wed, 08 Jun 2011 15:05:48 +0200 ApnsPHP[21724]: INFO: Retry to connect (3/3)...
Wed, 08 Jun 2011 15:05:49 +0200 ApnsPHP[21724]: INFO: Trying ssl://gateway.sandbox.push.apple.com:2195...

Fatal error: Uncaught exception 'ApnsPHP_Exception' with message 'Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195':  (0)' in /home/xxxx/xxxxx/ApnsPHP/Abstract.php:354
Run Code Online (Sandbox Code Playgroud)

sau*_*abh 18

这个解决方案对我有用.最初的答案是推送通知服务器实现 -

我找到了一个解决方案,我不知道它是否是最好的,但它确实有效.在Abstract.php(这个文件是apns-php源代码的一部分)我评论了第343行.现在它看起来像这样:

$streamContext = stream_context_create(array('ssl' => array(
//'verify_peer' => isset($this->_sRootCertificationAuthorityFile),
'cafile' => $this->_sRootCertificationAuthorityFile,
'local_cert' => $this->_sProviderCertificateFile
)));
Run Code Online (Sandbox Code Playgroud)

我真的不知道这一行有什么意义,但知道推送通知正常工作.


小智 9

即时我来说,我改线58和59的文件ApnsPHP/Push.php该 protected $_aServiceURLs = array( 'ssl://gateway.push.apple.com:2195', // Production environment 'ssl://gateway.sandbox.push.apple.com:2195' // Sandbox environment ); /< @type array Service URLs environments. */ protected $_aServiceURLs = array( 'gateway.push.apple.com:2195', // Production environment 'gateway.sandbox.push.apple.com:2195' // Sandbox environment ); /< @type array Service URLs environments. */ protected $_aServiceURLs = array( 'ssl://gateway.push.apple.com:2195', // Production environment 'ssl://gateway.sandbox.push.apple.com:2195' // Sandbox environment ); /< @type array Service URLs environments. */