Apple Push Notification doesn't work on my godaddy shared server, it couldn't connect. 111 is disabled.

I got an error as could not connect to 111 connection failed php push notification using APNS. It works fine on local server, but does not work on GoDaddy shared server. Please find my Php code.

$path_pem_file="http://dummy.com/uploads/app/1.pem";
// this is the pass phrase you defined when creating the key
$passphrase = '';
// this is where you can customize your notification
$payload = '{"aps":{"alert":"message","sound":"default"}}';

// start to create connection
$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', $path_pem_file);
stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);

$fp = stream_socket_client('ssl://gateway.sandbox.push.apple.com:2195', $err,   $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx);
// Build the binary notification
$msg = chr(0) . pack('n', 32) . pack('H*', 'Device token here..') . pack('n', strlen($payload)) . $payload;
// Send it to the server
$result = fwrite($fp, $msg, strlen($msg));

if ($fp) {  fclose($fp);}

      

+3


source to share


2 answers


To use Apple APNs, the following PORTS must be open on your server

2195
2196

      



As far as I know, GoDaddy will not open these ports for you on shared hosting and you will have to go for a dedicated server or VPS.

+4


source


If you are using GoDaddy web hosting, they will not open ports to send push. If you are using GoDaddy Virtual Private Servers, you can call them and unblock the ports.



You need to upgrade to dedicated hosting . Please take a look at the following url, it might help you: http://www.buzztouch.com/forum/thread.php?tid=b580c417cbbc86eb9575ea0¤tpage=1

+1


source







All Articles