can not connect the apples APN server for pusNotification from by PHP code
Posted
by faisal
on Stack Overflow
See other posts from Stack Overflow
or by faisal
Published on 2010-03-28T05:07:19Z
Indexed on
2010/03/28
5:13 UTC
Read the original article
Hit count: 334
Hi developers,
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? plz help.
NOTE: I can send pushnotification by my mac project (using push me baby project). But my PHP project failed to connect.
© Stack Overflow or respective owner