immobiliare / ApnsPHP

ApnsPHP: Apple Push Notification & Feedback Provider
BSD 3-Clause "New" or "Revised" License
1.44k stars 452 forks source link

Unable to connect to production server 'ssl://gateway.push.apple.com:2195' #107

Closed irfaniffi closed 8 years ago

irfaniffi commented 8 years ago

Hi,

I am facing issue with APNS php code for push notification on IOS devices, I have two separate connection for Development and Production.

  1. I have configure the development connection on my server by adding the .pem file certificate and Passphares its working perfect and I received the notification also. Have a look my development configuration:

Url: 'ssl://gateway.sandbox.push.apple.com:2195'

$push = new ApnsPHP_Push(
    ApnsPHP_Abstract::ENVIRONMENT_SANDBOX,
    'APNS_Dev_ISAS.pem'
);
$myNewLogger = new MyNewLogger();
$push->setLogger($myNewLogger);

// Set the Provider Certificate passphrase
$push->setProviderCertificatePassphrase('1234567');

$push->setRootCertificationAuthority('APNS_Dev_ISAS.pem');
$push->connect();

Issue:

  1. Than I configured the connection for Production by adding following parameters but I getting the connection error:

Url: ssl://gateway.push.apple.com:2195

$push = new ApnsPHP_Push(
    ApnsPHP_Abstract::ENVIRONMENT_PRODUCTION,
    'APNS_PROD_ISAS.pem'
);
$myNewLogger = new MyNewLogger();
$push->setLogger($myNewLogger);

// Set the Provider Certificate passphrase
$push->setProviderCertificatePassphrase('12345678');

$push->setRootCertificationAuthority('APNS_PROD_ISAS.pem');
$push->connect();

Error of connection: INFO: Trying ssl://gateway.push.apple.com:2195...ERROR: Unable to connect to 'ssl://gateway.push.apple.com:2195': (0) INFO: Retry to connect (1/3)...INFO: Trying ssl://gateway.push.apple.com:2195...ERROR: Unable to connect to 'ssl://gateway.push.apple.com:2195': (0) INFO: Retry to connect (2/3)... INFO: Trying ssl://gateway.push.apple.com:2195...ERROR: Unable to connect to 'ssl://gateway.push.apple.com:2195': (0) INFO: Retry to connect (3/3)... INFO: Trying ssl://gateway.push.apple.com:2195...ERROR: Unable to connect to 'ssl://gateway.push.apple.com:2195': (0)

I google the issue and I found the some solutions and I have check all and everything is fine but no success.

Any help will be appreciated really. Thanks in advance.

linshushu commented 8 years ago

http://stackoverflow.com/questions/5292247/push-notifications-server-implementation

irfaniffi commented 8 years ago

@linshushu Thanks for your response.

But I have already resolved it. I have created new certificate with minimum passphares and its working perfect. Thanks