【问题标题】:Push Notify iPhone推送通知 iPhone
【发布时间】:2011-10-30 14:50:10
【问题描述】:

我用这段代码推送:

push("xxxx", 3);

function push($deviceToken, $badge) {

    $message = "C'è il vento ideale!!";
    $sound = "default";

    // Construct the notification payload
    $body = array();
    $body['aps'] = array(
        "alert" => $message
    );
 
    if ($badge) {
        $body['aps']['badge'] = $badge;
    }

    if ($sound) {
        $body['aps']['sound'] = $sound;
    }

    $ctx = stream_context_create();
    stream_context_set_option($ctx, 'ssl', 'local_cert', 'apns-dev.pem');
    $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 $errstrn";
        return;
    } else {
        print "Connection OK\n";
    }

    $payload = json_encode($body);
    $msg = chr(0) . pack('n', 32) . pack('H*', str_replace(' ', '', $deviceToken)) . pack('n', strlen($payload)) . $payload;
    print "sending message :" . $payload . "\n";
    fwrite($fp, $msg);
    fclose($fp);
}

但这是错误:

警告:stream_socket_client() [function.stream-socket-client]:SSL 操作失败,代码为 1。OpenSSL 错误消息:错误:14094414:SSL 例程:SSL3_READ_BYTES:sslv3 警报证书在 /xxxx/notify.php 中被撤销第 75 行

警告:stream_socket_client() [function.stream-socket-client]:无法在第 75 行的 /xxxx/notify.php 中启用加密

警告:stream_socket_client() [function.stream-socket-client]: 无法连接到 /xxxxx/notify.php 中的 ssl://gateway.sandbox.push.apple.com:2196(未知错误)在线75 连接失败0

【问题讨论】:

  • 您的证书似乎不再有效。

标签: iphone apple-push-notifications php


【解决方案1】:

消息很明确:certificate revoked
您的证书无效、证书已过期或您在 Apple 门户中单击了“撤销”证书。

您可以为此 appId 生成一个新证书,并将其安装在您的服务器上。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-01-24
    • 1970-01-01
    • 1970-01-01
    • 2011-04-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多