【发布时间】:2019-04-07 08:11:37
【问题描述】:
我正在尝试使用 PHP 将通知发送到我的天蓝色通知中心。我正在使用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);
}
【问题讨论】:
-
400 清楚地表明请求格式错误(例如,无效的路由标头、无效的内容类型、消息超出大小、错误的消息格式)。您的中心名称是“美国中部”吗?请查看此博客以获取参考docs.microsoft.com/en-us/azure/notification-hubs/…
-
这是一个愚蠢的错误。将集线器名称更改为我的实际名称,现在一切正常。谢谢
-
很高兴知道它有效,我想请你接受这个作为答案,这样可以帮助所有有相同 ASK 的人。
标签: php azure push-notification azure-eventhub