Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apple Push Notification not working on shared server

I want to send APN (Apple Push Notification) from PHP script. My PHP script is working fine and I receive notification in the iphone device as well when sending from localhost but when I upload the same script with same .pem file to the shared server it returns error...

Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.push.apple.com:2195 (Connection refused) in /mypath/SendPushNotification.php on line 28 Failed to connect: 111 Connection refused

From some source I get to know that to send APN port 2195 must be open which is not possible in the shared server plan. So I tried using dedicated server and it's working perfectly and I receive the notification on the device. I tried hard to find the solution for shared server but didn't find any solution.

My question: is it possible send APN without opening port 2195 from shared server? if Yes give some guidance.

like image 401
Mohit Mehta Avatar asked Nov 17 '25 17:11

Mohit Mehta


1 Answers

No, Its not possible to send APN message without using 2195 port.

If you want to send push notification message from shared server, try using some third party tools like http://urbanairship.com/.

like image 97
user1113101 Avatar answered Nov 19 '25 05:11

user1113101