Problem: I cannot access APNS server. I get a 110 Connection Time Out error.
My situation:
- I've contacted my host (hostmonster). They said my port 2195,2196 are already open.
- My certificate and passphrase is no problem, for I've tested it from my local Mac.
I use a very simple PHP to test. Here's my code:
$ctx = stream_context_create(); stream_context_set_option($ctx, 'ssl', 'local_cert', 'apn.pem'); stream_context_set_option($ctx, 'ssl', 'passphrase', 'aaa'); $fp = stream_socket_client("ssl://gateway.sandbox.push.apple.com:2195", $err, $errstr,60,STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT,$ctx); if ($fp) echo ('aa'); else echo ($err.$errstr);