views:

1091

answers:

3

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

I am using the certificate, and the private key

$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', $certfile);
stream_context_set_option($ctx, 'ssl', 'passphrase', $pass);
$fp = stream_socket_client('ssl://gateway.xyz.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT, $ctx);

Its running in my local XAMPP Server , but its not working in the external server

What is the error ? Do i need to change some setting in the server ?

Thanks

+1  A: 

Check your personal firewall settings and make sure you're not blocking this out. Try disabling the firewall.

Also, some APIs like requests to come from an actual domain rather than a desktop. I don't have reason to believe Apple works this way, but that's something to check also.

Also make sure and ping gateway.sandbox.push.apple.com and make sure you have a good connection.

Jeremy Morgan
A: 

-bash-3.2# ping gateway.push.apple.com PING gateway.push-apple.com.akadns.net (17.149.38.147) 56(84) bytes of data.

I have tested pinging from 2 of our server and I believe that they are dropping ping on their servers.

palaniraja
+3  A: 

I had fixed the issue by opening the port 2195 on the production server. You can verify by following command $telnet gateway.push.apple.com 2195

-bash-3.2# telnet gateway.push.apple.com 2195

Trying 17.149.38.141...
Connected to gateway.push.apple.com (17.149.38.141).
Escape character is '^]'.
Connection closed by foreign host.
palaniraja