0

我可以在开发环境中通过证书向ck.pemiphone发送推送通知成功。gateway.sandbox.push.apple.com

但我想访问feedback.sandbox.push.apple.com,我得到如下错误:

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

警告:stream_socket_client() [function.stream-socket-client]:无法在第 8 行的 /Applications/XAMPP/xamppfiles/htdocs/iphone/freebackFromApple.php 中启用加密

警告:stream_socket_client() [function.stream-socket-client]:无法连接到 /Applications/XAMPP/xamppfiles/htdocs/iphone/ 中的 ssl://feedback.sandbox.push.apple.com:2196(未知错误)第 8 行的 freebackFromApple.php 连接反馈服务器失败:0

我的php代码如下:

<?php

$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', '/Applications/XAMPP/xamppfiles/htdocs/iphone/share/ck.pem');
stream_context_set_option($ctx, 'ssl', 'verify_peer', false);
stream_context_set_option($ctx, 'ssl', 'passphrase', '');
$fp = stream_socket_client('ssl://feedback.sandbox.push.apple.com:2196', $error, $errorString, 60, STREAM_CLIENT_CONNECT, $ctx);

if (!$fp) {
    print "Failed to connect feedback server: $error $errorString\n";
    return;
else {
    print "Connection to feedback server OK\n";
}

print "APNS feedback results\n";
while ($devcon = fread($fp, 38)) {
    $arr = unpack("H*", $devcon);
    $rawhex = trim(implode("", $arr));
    $feedbackTime = hexdec(substr($rawhex, 0, 8));
    $feedbackDate = date('Y-m-d H:i', $feedbackTime);
    $feedbackLen = hexdec(substr($rawhex, 8, 4));
    $feedbackDeviceToken = substr($rawhex, 12, 64);
    print "TIMESTAMP:" . $feedbackDate . "\n";
    print "DEVICE ID:" . $feedbackDeviceToken . "\n\n";
}
fclose($fp);
?>
4

2 回答 2

1

只需转到 Apple 的配置网站尝试下载证书以再次合并到 ck.pem,然后将其放入您的服务器站点。它对我有用,是的。

于 2011-12-14T05:18:34.793 回答
0

看起来像证书错误。您是否在 Apple 的配置网站上检查过您的 SSL 证书是否是最新的?

您还必须在证书文件旁边指定密钥文件。

于 2011-05-24T07:13:15.537 回答