I tested the push notification on my local machine, it works fine. Then I uploaded my files to a real server with the same certificate (".pem" file), and I guarantee that ports 2195 and 2196 are open.
I tested:
telnet gateway.sandbox.push.apple.com 2195
He works...
root@server ~ # telnet gateway.sandbox.push.apple.com 2195 Trying 17.149.34.54... Connected to gateway.sandbox.push.apple.com. Escape character is '^]'.
But when I test my php script, it returns:
Warning: stream_socket_client () [function.stream-socket-client]: cannot connect to ssl: //gateway.sandbox.push.apple.com: 2195 (Connection timeout)
Warning: stream_socket_client () [function.stream-socket-client]: could not connect to ssl: //feedback.sandbox.push.apple.com: 2196
Any suggestions?
This is the php code:
$ctx = stream_context_create(); stream_context_set_option($ctx, 'ssl', 'local_cert', "path/to/certificate"); $fp = stream_socket_client("ssl://gateway.push.apple.com:2195", $error, $errorString, 100, (STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT), $ctx);
source share