PHP如何解压Apple APNS反馈数据
我已成功连接到 Apple 的反馈 APNS 服务器,但我不确定如何解压从 fread() 获得的二进制数据。有谁知道该怎么做?文档说前 4 个字节是时间戳,接下来的 2 个字节是令牌长度,其余是设备令牌。
在调用 fread 之后,如何将这些信息解压缩为可读字符?
I've successfully managed to connect to Apple's feedback APNS server but I'm not sure how to unpack the binary data you get from fread(). Does anyone know how to do this? The documentation says the first 4 bytes are the timestamp, the next 2 are the token length and the rest are the device token.
How does this info get unpacked into readable characters after the call to fread?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一旦你有了二进制流,你可以像这样处理它:
$feedback 将是一个包含元素“timestamp”、“length”和“devtoken”的关联数组。
Once you have your binary stream, you can process it like this:
$feedback will be an associative array containing elements "timestamp", "length" and "devtoken".
实际想了一下,这个似乎更靠谱:
Actually figured it out, this seems to be more reliable: