如何使用Azure通知中心使用PHP发送通知?

问题描述 投票:0回答:1

我正在尝试使用PHP将通知发送到我的azure通知中心。我正在使用these 2类发送通知。当我尝试发送通知时,我看到了这个错误

{ "message": "Error sending notificaiton: 400 msg: \r\n\r\n\r\n

Bad Request

\r\n
HTTP Error 400. The request is badly formed.

我的功能是

public function sendNotificationHub() {


        $hub    =   new \App\Helpers\NotificationHub('connection string', 'central US');
        $message = '{"data":{"message":"Hello from PHP!"}}';

        $notification   =   new \App\Helpers\Notfication("gcm", $message);

        $hub->sendNotification($notification, null);
    }
php azure push-notification azure-eventhub
1个回答
0
投票

400清楚地表明请求格式错误(例如,无效的路由标头,无效的内容类型,消息超出大小,错误的消息格式)。

您的枢纽名称是“美国中部”吗?请查看此博客以供参考

https://docs.microsoft.com/en-us/azure/notification-hubs/notification-hubs-php-push-notification-tutorial

看看它是否有帮助。

© www.soinside.com 2019 - 2024. All rights reserved.