Push notifications server implementation

16,700

I have found a solution, I don't know if it's the best, but it works. On Abstract.php (this file is part of the apns-php source) I have commented the line 343. Now it looks like this:

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

I really don't know what is the point of this line, but know the push notification is working properly. My doubt is if it will work properly too on production server. Someone knows?

Share:
16,700
Sebastian
Author by

Sebastian

Updated on June 04, 2022

Comments

  • Sebastian
    Sebastian about 2 years

    I'm trying to make work apns-php (http://code.google.com/p/apns-php/) on my server (Bluehost with dedicated IP and port 2195 open for tcp and udp outgoing).

    I'm getting this error:

    Fatal error: Uncaught exception 'ApnsPHP_Exception' with message 'Unable to connect to 'ssl://gateway.sandbox.push.apple.com:2195': (0)' in /home2/xxxxx/public_html/xxxxx/pns/ApnsPHP/Abstract.php:352 Stack trace: #0 /home2/xxxxx/public_html/xxxxx/pns/ApnsPHP/Abstract.php(295): ApnsPHP_Abstract->_connect() #1 /home2/xxxxx/public_html/xxxxx/pns/sample_push.php(41): ApnsPHP_Abstract->connect() #2 {main} thrown in /home2/xxxxx/public_html/xxxxx/pns/ApnsPHP/Abstract.php on line 352

    I have contact Bluehost support and they told me this:

    Thanks for contacting us. If seems as though the server ssl://gateway.sandbox.push.apple.com:2195* is refusing to accept the connection made from your account. Is there a way you can whitelist your dedicated ip or accept incoming connections on their end?

    Someone can help me to solve this out? Any ideas? Thanks!