日期:2014-05-17 浏览次数:20550 次
stream_context_set_option($ctx, 'ssl', 'local_cert', $pemFile);//$pemFile为证书文件,这个你自己上网找找生成步骤,你必须得有个apple开发帐号
$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);
// Open a connection to the APNS server,推送服务api,以下是沙箱环境
$fp = stream_socket_client('ssl://gateway.sandbox.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT
------解决方案--------------------
STREAM_CLIENT_PERSISTENT, $ctx);
// Create the payload body
$body['aps'] = array(
'alert' => array(
'body' => $message,
//'action-loc-key' => 'Bango App',
),
'badge' => $badge,
'sound' => 'oven.caf',
);
$deviceTokens = array();
$payload = FMFactory::GetJson()->encode($body);