您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

用php搭建apns推送服务器

2025/11/23 12:16:21发布22次查看
是按照教程http://blog.csdn.net/newjueqi/article/details/7898591 来做的。 注意事项: 1. 测试阶段使用的推送地址: ssl://gateway.sandbox.push.apple.com:2195 正式上线使用的推送地址: ssl://gateway.push.apple.com:2195 2. 那里给的php推送代码有问
是按照教程 http://blog.csdn.net/newjueqi/article/details/7898591 来做的。
注意事项:
1. 测试阶段使用的推送地址:
ssl://gateway.sandbox.push.apple.com:2195
正式上线使用的推送地址:
ssl://gateway.push.apple.com:2195
2. 
那里给的php推送代码有问题,下面我贴出修改后推送成功的代码:
$message,'forum_id' => 88,'topic_id' => 999,);// encode the payload as json$payload = json_encode($body);// build the binary notification//$msg = chr(0).pack('n', 32).pack('h', $devicetoken). pack('n', strlen($payload)).$payload;$msg = chr(0) . pack(n,32) . pack('h*', str_replace(' ', '', $devicetoken)) . pack(n,strlen($payload)) . $payload;// send it to the server$result = fwrite($fp, $msg, strlen($msg));if (!$result){ echo 'message not delivered' . php_eol;}else{ echo 'message successfully delivered' . php_eol;}// close the connection to the serverfclose($fp);?>
[文章作者]曾健生
[作者邮箱]zengjiansheng1@126.com
[作者qq]190678908
[博客]  http://blog.csdn.net/newjueqi
http://blog.sina.com.cn/h6k65
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product