我正在尝试使用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);
}
400清楚地表明请求格式错误(例如,无效的路由标头,无效的内容类型,消息超出大小,错误的消息格式)。
您的枢纽名称是“美国中部”吗?请查看此博客以供参考
看看它是否有帮助。