ds753947
2019-04-07 08:11
浏览 88
已采纳

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

I am trying to send the notification to my azure notification hub using PHP. I am using these 2 classes to send out the notifications. When I try to send the notifications, I see this error

{ "message": "Error sending notificaiton: 400 msg: 




Bad Request



HTTP Error 400. The request is badly formed.

My function is

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);
    }
  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • duanqun7761 2019-04-08 06:39
    已采纳

    400 clearly indicate that the request is malformed (for example, not valid routing headers, not valid content-type, message exceeds size, bad message format).

    Is your hub name is "Central US"? Please check this blog for reference

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

    See if it helps.

    已采纳该答案
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题