From 37c9ce7cc0686c7fdc2fffb3ff248a3f76223c85 Mon Sep 17 00:00:00 2001 From: Ani Sinanaj Date: Tue, 10 Jan 2017 16:35:33 +0100 Subject: [PATCH] Added php example using google's Firebase endpoint --- android/firebasetest | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 android/firebasetest diff --git a/android/firebasetest b/android/firebasetest new file mode 100755 index 0000000..fef52ca --- /dev/null +++ b/android/firebasetest @@ -0,0 +1,41 @@ +#!/usr/bin/php + array ( + $id + ), + "data" => [ + "data" => [ + "alert" => "Testing " . time(), + "title" => "The title", + "vibrate" => [100,50,50,50,100], + "badge" => 1, + "tag" => "APP" + ] + ] + ); + $fields = json_encode ( $fields ); + + $headers = array ( + 'Authorization: key=' . "", + 'Content-Type: application/json' + ); + + $ch = curl_init (); + curl_setopt ( $ch, CURLOPT_URL, $url ); + curl_setopt ( $ch, CURLOPT_POST, true ); + curl_setopt ( $ch, CURLOPT_HTTPHEADER, $headers ); + curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true ); + curl_setopt ( $ch, CURLOPT_POSTFIELDS, $fields ); + + $result = curl_exec ( $ch ); + echo $result; + curl_close ( $ch ); +} + +sendGCM("Test", "DEVICE TOKEN"); \ No newline at end of file