└── sendnotification.php /sendnotification.php: -------------------------------------------------------------------------------- 1 | $_GET['body'], 9 | 'title' => $_GET['title'], 10 | 'vibrate' => 1, 11 | 'sound' => 1, 12 | ); 13 | $fields = array 14 | ( 15 | 'registration_ids' => $registrationIds, 16 | 'notification' => $msg 17 | ); 18 | 19 | $headers = array 20 | ( 21 | 'Authorization: key=' . API_ACCESS_KEY, 22 | 'Content-Type: application/json' 23 | ); 24 | 25 | $ch = curl_init(); 26 | curl_setopt( $ch,CURLOPT_URL, 'https://fcm.googleapis.com/fcm/send' ); 27 | curl_setopt( $ch,CURLOPT_POST, true ); 28 | curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers ); 29 | curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true ); 30 | curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false ); 31 | curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) ); 32 | $result = curl_exec($ch ); 33 | curl_close( $ch ); 34 | echo $result; 35 | ?> --------------------------------------------------------------------------------