如何在PHP中使用FCM HTTP v1 API [英] How to use the FCM HTTP v1 API with php

查看:260
本文介绍了如何在PHP中使用FCM HTTP v1 API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将FCM与旧版协议一起使用,但是找不到任何具体文档来将新的FCM HTTP v1 API与php一起使用.

I have used FCM with the legacy protocol but cannot find any concrete documentation to use the new FCM HTTP v1 API with php.

我已经成功导入了 Google API客户端库进入我的项目,但找不到有关如何获取fcm消息所需作用域的访问令牌的任何文档或教程.

I have managed to import the Google API Client Library into my project but cannot find any documentation or tutorials on how to obtain the access token for the required scopes for fcm messages.

推荐答案

如果您愿意使用现有的库而不是自己实现,则可以考虑查看

If you are willing to use an existing library instead of implementing it yourself, you might consider having a look at https://github.com/kreait/firebase-php/ which has received support for FCM just today.

https://firebase-php.readthedocs.io/en /latest/cloud-messaging.html

如果不适合您,则至少可以从源代码中提取使用PHP与FCM REST API的连接.简而言之,它是 https://firebase.google的实现.com/docs/reference/fcm/rest/v1/projects.messages .

If it isn't for you, you will at least be able to extract the connections to the FCM REST API with PHP from the source code. In short, it's the implementation of https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages .

这篇关于如何在PHP中使用FCM HTTP v1 API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆