To connect my server with the APN server I use the following code.

```
// coonecting the apn server
$apnsHost = 'gateway.sandbox.push.apple.com';
$apnsPort = 2195;
$apnsCert = 'apns-dev.pem';
$streamContext = stream_context_create();
stream_context_set_option($streamContext, 'ssl', 'local_cert', $apnsCert);

$apns = stream_socket_client('ssl://' . $apnsHost . ':' . $apnsPort, $errorNo, $errorString, 2, STREAM_CLIENT_CONNECT, $streamContext);

```

**But I am failed to connect, I print the $errorNo and $errorString
the output was: 
error: Connection timed out
errorNo: 110**

But I am also getting the following warnings in errorLog:

> 
> Unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Connection timed out) in /home/riseupla/public\_html/applications/apn/apn.php on line 35
> 
> 
> 

What shoud I do?

*NOTE*:
I can send push notifications by my mac project (using push me baby project).
But my PHP project failed to connect.