Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么在PHP firebase rest api中出现无效密钥类型错误? <?php // API access key from Google API's Console define('API_ACCESS_KEY','AIzaSyDvkI_Php_Firebase_Rest_Firebase Cloud Messaging - Fatal编程技术网

为什么在PHP firebase rest api中出现无效密钥类型错误? <?php // API access key from Google API's Console define('API_ACCESS_KEY','AIzaSyDvkI

为什么在PHP firebase rest api中出现无效密钥类型错误? <?php // API access key from Google API's Console define('API_ACCESS_KEY','AIzaSyDvkI,php,firebase,rest,firebase-cloud-messaging,Php,Firebase,Rest,Firebase Cloud Messaging,为什么在PHP firebase rest api中出现无效密钥类型错误? <?php // API access key from Google API's Console define('API_ACCESS_KEY','AIzaSyDvkIrQby4Zz_9YMGYwk###TjqftHM5IPw'); $receiver = $_POST['receiver']; $body = $_POST['body']; $title= $_POST['title']; //

为什么在PHP firebase rest api中出现无效密钥类型错误?

<?php // API access key 
from Google API's Console
define('API_ACCESS_KEY','AIzaSyDvkIrQby4Zz_9YMGYwk###TjqftHM5IPw');

$receiver = 
$_POST['receiver']; 
$body = $_POST['body']; 
$title= $_POST['title']; 
// prep the bundle 
$msg = array ( 'body' => 
$body,
'title' => $title ); 
$fields = array ( 'to' =>'/topics/'.$receiver,'notification' => $msg ); 
 $headers = array(
'Authorization: key='.API_ACCESS_KEY,'Content-Type: application/json');
$ch = curl_init(); 
curl_setopt($ch,CURLOPT_URL,'https://fcm.googleapis.com/fcm/send');curl_setopt($ch,CURLOPT_POST,true );
curl_setopt($ch,CURLOPT_HTTPHEADER, $headers );
curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) );
$result = curl_exec($ch );
curl_close( $ch );
echo $result;?>