SAE的苹果消息推送服务

 http://blog.sina.com.cn/s/blog_61bd8a8b01018tla.html

服务摘要

        saeapns(SAE - Apple Push Notification Service),是SAE为iOS开发者提供的可以 快速、简单实现苹果的消息推送的服务。

 

应用场景

        快速实现iOS的消息推送 (Apple Push Notification Service)

 

PHP调用方式
 

使用指南
    include_once("saeapns.class.php");
 
    /* int $cert_id  许可证序号(1-10)*/
    $cert_id = 12345;
 
    /* string $device_token 设备令牌 */
    $device_token = 'xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx';
 
    /* string $message 消息内容 */                         
    $message = date('Y-m-d H:i:s') . ": \n" . '测试消息 from SAE';
 
 
    /*
    array $body 消息体(包括消息、提醒声音等等),格式请参考示例和Apple官方文档
    */
 
    $body = array(
        'aps' => array('alert' => $message, 'badge' => 1, 'sound' => 'in.caf'),
        'others' => array()
    );
 
    //实例化SaeAPNS
 
    $apns = new SaeAPNS();
 
    //推送消息
 
    $result = $apns->push($cert_id, $body, $device_token);
 
    if ($result !== false) {
 
        echo '发送成功';
     
    } else {
  
        echo '发送失败';
        var_dump($apns->errno(), $apns->errmsg());   
    }  

 

   

  详细介绍:http://saeapns.sinaapp.com/doc.html

上传的地址:

http://sae.sina.com.cn/?m=push&app_id=这里改成你的应用ID&ver=1

文档看http://saeapns.sinaapp.com/doc.html 这个

猜你喜欢

转载自duchengjiu.iteye.com/blog/1955305