How to send an apple mdm push notification with plain php?

前端 未结 2 1966
鱼传尺愫
鱼传尺愫 2021-01-29 03:10

i\'ve done a apple-mdm-ota-server for IOS so far. The devices deliver me following things to the server (in form of a plist/xml):

-Push Magic Token -Device Token (in b64

2条回答
  •  伪装坚强ぢ
    2021-01-29 03:51

    use this libray

    function push_device($data) {
        $push = new ApnsPHP_Push(
            ApnsPHP_Abstract::ENVIRONMENT_PRODUCTION,
            '../MyPushCert.pem'
        );
        $push->connect();
        $message = new ApnsPHP_Message_Custom($data["Token"]);
        $message->setCustomProperty('mdm', $data["PushMagic"]);
        $push->add($message);
        $push->send();
        $push->disconnect();
    }
    

提交回复
热议问题