为Apple Push开发的PHP PEAR 包:Services_Apple_PushNotification
Apple Push Notification Service:通过苹果服务器向app用户推送消息,无需启动app。
对于这种第三方库,PHP官方称之为PEAR,需要按照PEAR标准开发(标准URI)。
PEAR的优势:一键安装到php/lib/php目录,require即可使用,很方便。
PHP PEAR上有一个Services_Apns,github上有一个Services_APNS,但都无法使用,所以我开发了一个,安装步骤如下:
pear channel-discover sinkcup.github.io/pear
pear install sinkcup/Services_Apple_PushNotification
使用步骤:
1、登录苹果开发者后台,下载dev或prod证书,合并成pem文件。在ios app里添加push权限,获得device token。参考:http://www.cnblogs.com/gpwzw/archive/2012/03/31/Apple_Push_Notification_Services_Tutorial_Part_1-2.html
2、demo(参考)
<?php
require_once 'Services/Apple/PushNotification.php';
$conf = array(
'password' => '',
'cert' => '/home/u1/cert.pem-sandbox',
);
$o = new Services_Apple_PushNotification('sandbox', $conf);
$deviceToken = 'aaaf818eaae8a5aa11aaaf9aa8f8aa15aaefae75a1aaaa597e51917aa2a1a111';
$data = array(
'aps' => array(
'alert' => '测试push sandbox',
'badge' => ,
'sound' => 'default',
)
);
$r = $o->send($deviceToken, $data);
var_dump($r);
exit;
?>
输出:
bool(true)
我的PEAR 频道:http://sinkcup.github.io/pear/
Services_Apple_PushNotification项目代码:https://github.com/sinkcup/Services_Apple_PushNotification
为Apple Push开发的PHP PEAR 包:Services_Apple_PushNotification的更多相关文章
- 为七牛云存储开发的PHP PEAR 包:Services_Qiniu
七牛云存储Qiniu Resource (Cloud) Storage:用于存储图片.apk等静态资源. 优点: 1.使用七牛带宽和CDN,速度快,不占用开发者服务器. 2.支持图片任意格式.任意分辨 ...
- 为阿里云存储开发的PHP PEAR 包:Services_Aliyun_OSS
阿里云开放存储服务 OSS:用于存储图片.apk等静态资源,使用阿里云带宽,不占用开发者服务器带宽. 阿里云官方PHP SDK: http://aliyun.com/product/oss/#help ...
- (转)在SAE使用Apple Push Notification Service服务开发iOS应用, 实现消息推送
在SAE使用Apple Push Notification Service服务开发iOS应用, 实现消息推送 From: http://saeapns.sinaapp.com/doc.html 1,在 ...
- 改写百度云推送SDK,PHP PEAR 包:Services_Baidu_Push
iPhone使用apple push很方便,而Android很多厂商删除了google push,而且google在大陆连不上,所以要用别的办法. Android常见的推送服务商有:极光推送(http ...
- [Erlang 0106] Erlang实现Apple Push Notifications消息推送
我们的IOS移动应用要实现消息推送,告诉用户有多少条消息未读,类似下图的效果(笑果),特把APNS和Erlang相关解决方案笔记于此备忘. 上面图片中是Apple Notif ...
- PHP发短信 PEAR 包:Services_Sms
PHP发短信 PEAR 包:Services_Sms 对于这种第三方库,PHP官方称之为PEAR,需要按照PEAR标准开发(标准URI). PEAR的优势:一键安装到php/lib/php目录,req ...
- 远程通知APNs(Apple Push Notification Server)
推送通知是由应用服务提供商发起的,通过苹果的APNs(Apple Push Notification Server)发送到应用客户端.下面是苹果官方关于推送通知的过程示意图: 推送通知的过程可以分为以 ...
- (转)苹果推送通知服务教程 Apple Push Notification Services Tutorial
本文译自http://www.raywenderlich.com/.原文由iOS教程团队 Matthijs Hollemans 撰写,经原网站管理员授权本博翻译. 在iOS系统,考虑到手机电池电量,应 ...
- PHP之pear包总结
现在我们开发的时候,尤其是使用框架进行项目开发的时候,都会有一个专门的包管理工具,对,那就是composer,使用这个工具可以简单快速的引入一个代码包,十分快捷好用.接下就总结一下,经常使用到的pea ...
随机推荐
- Shader LOD
设置:单个设置Shader.maximumLOD.全局设置Shader.globalMaximumLOD.QualitySettings里面的Maximum LODLevel 原理:小于指定值的sha ...
- 【原创】.NET读写Excel工具Spire.Xls使用(2)Excel文件的控制
本博客所有文章分类的总目录:http://www.cnblogs.com/asxinyu/p/4288836.html .NET读写Excel工具Spire.Xls使用文章 ...
- 初探JavaScript(三)——JS带我"碰壁"带我飞
已经写了两篇关于小白的JavaScript之行,不可否认,每一种语言都有其精华与糟粕之处,来不及细细体味其精华奥妙,也没法对其评头论足,只能先了解,后深入.到目前为止已经看完<JavaScrip ...
- Android抓包方法(二)之Tcpdump命令+Wireshark
Android抓包方法(二) 之Tcpdump命令+Wireshark 前言 做前端测试,基本要求会抓包,会分析请求数据包,查看接口是否调用正确,数据返回是否正确,问题产生是定位根本原因等.学会抓包分 ...
- Windows Azure HandBook (8) Azure性能测试(1)
<Windows Azure Platform 系列文章目录> 我们在项目上线之前,常常需要对部署在微软云上的应用软件做压力测试. 一般的压力测试,常常在本地计算机安装压力测试软件 (比如 ...
- QT学习笔记3
对话框 新建了一个对话框,在新建项目选择类型时是Dialog即可. 添加的代码如下,注意QCheckBox 并没有添加头文件定义,只是加了类的前向声明.因为我们仅仅使用的是指针,并不涉及到这些类的函数 ...
- matlab 读取excel
clear;clc; tic;%启动计时器,计算程序运行时间 a=xlsread('C:\Documents and Settings\Administrator\桌面\data.xls');b=a( ...
- 用Latex写学术论文:作者(Author)&摘要(Abstract)
标题&作者 1.标题 \title{} "Line breaks (\\) may be used to equalize the length of the title lines ...
- .NET 2.0 检测
#include <stdio.h>#include <stdlib.h>#include<windows.h> char GetSystemDisk(){ ...
- 使用System.IO来读取以及修改文本文件
//1.读取html内容 string htmlUrl = @"new\new.html"; string htmlContent = string.Empty; using (S ...