Note that there are some explanatory texts on larger screens.

plurals
  1. POPush Notification Failed to connect no error string
    primarykey
    data
    text
    <p>I gone through almost all the thread related to this on stackoverflow but not helped me much may be I did not understood well. When I am sending push notification using my php code then it is saying Failed to connect. I have used the same code for many other projects earlier. but this time I am not able to find where the problem is</p> <p><strong>PHP CODE</strong></p> <pre><code> $status_message="Failure"; $deviceToken = ""; $userExist=1; $message = 'You Recieved a new Notifcation from test'; $badge = (int)1; $sound = 'cow.caf'; $body = array(); if($userExist==1) { $body['aps'] = array('alert' =&gt; $message); $body['aps']['sound'] = $sound; if(isset($badge)) { $body['aps']['badge'] = $badge; } else { $body['aps']['message'] = $message; } } $ctx = stream_context_create(); stream_context_set_option($ctx,'ssl','local_cert','apns-dev.pem'); stream_context_set_option($ctx,'ssl','verify_peer',false); $fp = @stream_socket_client('ssl://gateway.sandbox.push.apple.com:2195', $err,$errstr, 60, "STREAM_CLIENT_CONNECT", $ctx); if (!$fp) { print "Failed to connect $err $errstr\n"; print_r($err); return; } else { print "Connection OK\n"; } </code></pre> <p><strong>IPhone END</strong></p> <p>I am getting failed to connect 0 0. I had a conversation with iphone guys they said their PEM is correct which is another possible reason for this. but they tested at their end and push is coming at their end. they are sure they are right. The PEM file is at correct place at server.</p> <p>Now comes the server settings, they have enabled tcp 2195,2196</p> <p><strong>Server ENd</strong></p> <pre><code>root@servername [~]# openssl version OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008 root@servername [~]# iptables -nL | grep 2195 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp spt:2195 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:2195 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:2195 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:2195 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:2195 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp spt:2195 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:2195 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:2195 root@servername [~]# iptables -nL | grep 2196 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp spt:2196 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:2196 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:2196 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp spt:2196 </code></pre> <p>I tried PUTTY to vertify the telnet gateway.push.apple.com 2195 and it is connecting from server.</p> <p>I am not sure where the problem is. I am sure about the code as I have used the same file in 6 projects. My hosting is VPS</p> <p>Please help</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload