使用php和firebase控制台帐户发送推送通知

to all, ehm i have this php code:

    <?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR_FIREBASE_API_ACCESS_KEY' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
(
    'body'  => $_GET['body'],
    'title'     => $_GET['title'],
    'vibrate'   => 1,
    'sound'     => 1,
);
$fields = array
(
    'registration_ids'  => $registrationIds,
    '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;
?>

I've just searched but what i would want is:

1) Which is the YOUR_FIREBASE_API_ACCESS_KEY? In settings of my app in firebase i see SERVER KEY, PREVIOUS SERVER KEY (translated from italian) and SENDER ID.

2) How can i get registration ids from firebase account app? If i want send push notification to all device that have installed this app how can i DO it?

3) When button clicked:

  • Connect to firebase account throught API key (Which is?)
  • Send to all devices that have my app installed (topic or not?)

Please, help me. I'm confused.

More than clear of that i can't.

Thanks Davide