Cannot send message to apns?
<p>Hello i wanna send message to my iphone</p>

<p>my php code is</p>

<pre><code>&lt;?php

// set time limit to zero in order to avoid timeout
set_time_limit(0);

// charset header for output
header('content-type: text/html; charset: utf-8');

// this is the pass phrase you defined when creating the key
$passphrase = 'Zazimi16';

// you can post a variable to this string or edit the message here
//if (!isset($_POST['msg'])) {
//$_POST['msg'] = "Notification message here!";
//}

// tr_to_utf function needed to fix the Turkish characters
//$message = tr_to_utf($_POST['msg']);

$message = 'test';

// load your device ids to an array
$deviceIds = array(
'f67f045d934cdc1bfa9f41e333aa47d0841c4c833bc38c7252cb137c7067ecda',
);

// this is where you can customize your notification
$payload = '{"aps":{"alert":"' . $message . '","sound":"default"}}';

$result = 'Start' . '&lt;br /&gt;';

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

echo count($deviceIds) . ' devices will receive notifications.&lt;br /&gt;';

foreach ($deviceIds as $item) {
    // wait for some time
    sleep(1);

    // Open a connection to the APNS server
    $fp = stream_socket_client('ssl://gateway.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT, $ctx);

    if (!$fp) {
        exit("Failed to connect: $err $errstr" . '&lt;br /&gt;');
    } else {
        echo 'Apple service is online. ' . '&lt;br /&gt;';
    }

    // Build the binary notification
    $msg = chr(0) . pack('n', 32) . pack('H*', $item) . pack('n', strlen($payload)) . $payload;

    // Send it to the server
    $result = fwrite($fp, $msg, strlen($msg));

    if (!$result) {
        echo 'Undelivered message count: ' . $item . '&lt;br /&gt;';
    } else {
        echo 'Delivered message count: ' . $item . '&lt;br /&gt;';
    }

    if ($fp) {
        fclose($fp);
        echo 'The connection has been closed by the client' . '&lt;br /&gt;';
    }
}

echo count($deviceIds) . ' devices have received notifications.&lt;br /&gt;';

// function for fixing Turkish characters
function tr_to_utf($text) {
    $text = trim($text);
    $search = array('Ü', 'Þ', 'Ð', 'Ç', 'Ý', 'Ö', 'ü', 'þ', 'ð', 'ç', 'ý', 'ö');
    $replace = array('Ãœ', 'Åž', '&amp;#286;ž', 'Ã‡', 'Ä°', 'Ã–', 'Ã¼', 'ÅŸ', 'ÄŸ', 'Ã§', 'Ä±', 'Ã¶');
    $new_text = str_replace($search, $replace, $text);
    return $new_text;
}

// set time limit back to a normal value
set_time_limit(30);
?&gt;
</code></pre>

<p>but i when i send i have it text</p>

<pre><code>1 devices will receive notifications.
Apple service is online. 
Delivered message count: f67f045d934cdc1bfa9f41e333aa47d0841c4c833bc38c7252cb137c7067ecda
The connection has been closed by the client
1 devices have received notifications.
</code></pre>