PHP Push notification error in iphone?
<p>I'm getting the device to register , but I can't send the push. 
Is this a port issue I need to configure with my host? </p>

<p>here is my full error messages</p>

<pre><code>Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Connection timed out) in /home/content/w/i/s/wiseinmotion/html/appologie/admin/push/push_notify.php on line 90
Connection Failed - iPhone Push Notifications ServerConnection timed out
110

Fatal error: Call to undefined function socket_close() in /home/content/w/i/s/wiseinmotion/html/appologie/admin/push/push_notify.php
</code></pre>

<p>here is my code plz tell me where i put wrong step </p>

<pre><code>function pushMessage($deviceToken,$message,$app) {
    echo "Sending iPhone Push Notifications to " . $deviceToken . "&lt;br /&gt;&lt;br /&gt;";
    echo "Your Message: " . $message . "&lt;br /&gt;";
    $time = time();
    $apnsHost = 'gateway.push.apple.com'; 
    $apnsPort = 2195;
    $apnsCert = './apns-iclean.pem';
    $streamContext = stream_context_create();
    stream_context_set_option($streamContext, 'ssl', 'local_cert', $apnsCert);
    $apns = stream_socket_client('ssl://' . $apnsHost . ':' . $apnsPort, $error, $errorString, 2, STREAM_CLIENT_CONNECT, $streamContext);
    if($apns) {
            $payload = array();
            $payload['aps'] = array('alert' =&gt; $message, 'badge' =&gt; 1, 'sound' =&gt; 'default');
            $payload = json_encode($payload);
            $apnsMessage = chr(0) . chr(0) . chr(32) . pack('H*', str_replace(' ', '', $deviceToken)) . chr(0) . chr(strlen($payload)) . $payload;
            fwrite($apns, $apnsMessage);
    } else { 
            echo "Connection Failed - iPhone Push Notifications Server";
            echo $errorString."&lt;br /&gt;";
            echo $error."&lt;br /&gt;";
    }
    //socket_close($apns);
    fclose($apns);
}
</code></pre>

<p>please guide me....</p>

<p>thanks for advance..</p>
