IPhone Removal Notification Cannot Connect to SSL Server

I followed the instructions below:

How to create an Apple Push notification provider server When I run php script on my MacOSX or on Windows using Parallel desktop, the script works. But as soon as I start it on my hosting, I get a message:

Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Connection timed out) in provider.php on line 23 Failed to connect 110 Connection timed out 

Is it related to certificates? If so, how can I make a certificate that could work on the computer where my hosting is located.

+3
source share
3 answers

Your hosting provider probably does not allow outgoing connections to ports 2195 and 2196. Most hosting providers do not have these ports. You may need to get a VPS or you can also try UrbanAirship, which provides integration with the Apple Notification Service and is free for a specific monthly limit.

+4
source

Yes, you need a certificate. This is explained in Apple docs. One catch, you probably need to convert the certificate to .pem format. The .pem certificate must include both the certificate and the RSA private key.

Here is a good site to read: http://www.macoscoders.com/2009/05/17/iphone-apple-push-notification-service-apns/

My pem looks like this:

 Bag Attributes friendlyName: Apple Development Push Services: <my data> localKeyID: <my local key in hexascii> subject=/UID=com.my.push.sandbox1/CN=Apple Development Push Services: <my data>/C=US issuer=/C=US/O=Apple Inc./OU=Apple Worldwide Developer Relations/CN=Apple Worldwide Developer Relations Certification Authority -----BEGIN CERTIFICATE----- <my certificate data omitted> -----END CERTIFICATE----- -----BEGIN RSA PRIVATE KEY----- <my key data omitted> -----END RSA PRIVATE KEY----- 
+1
source

I found that the easiest and cheapest solution was to request a dedicated IP address from your hosting company. At Blue Host, it was $ 2.50 a month. Using this dedicated IP address, they were ready to open ports 2195 and 2196.

+1
source

All Articles