コード例 #1
0
 /**
  * Abstract sender method
  *
  * @param User $user The recipient user
  * @param Notification $notification the notification to be sent
  * @param NotificationContent $content the content
  * @return mixed
  */
 public function sendNotification(User $user, Notification $notification, NotificationContent $content)
 {
     $query = ParseInstallation::query();
     $query->equalTo('user_id', $user->id);
     $data = ['alert' => $content->render('push_message', $notification)];
     $result = ParsePush::send(array('where' => $query, 'data' => $data));
     return is_array($result) && isset($result['result']) && $result['result'];
 }
コード例 #2
0
ファイル: Push.php プロジェクト: netsti/vaclases
 public static function email($type, $email, $title = "")
 {
     ParseClient::initialize(self::$app_id, self::$rest_key, self::$master_key);
     $alert = ["Nuevas validaciones disponibles", "Tiene un nuevo evento disponible", "Nuevas encuestas disponibles", "Tiene un nuevo mensaje"];
     $query = ParseInstallation::query();
     $query->equalTo("email", $email);
     ParsePush::send(array("where" => $query, "data" => array("title" => "VaClases", "alert" => ($title ? $title . " - " : "") . $alert[$type])));
 }
コード例 #3
0
 /**
  * Abstract sender method
  *
  * @param User $user The recipient user
  * @param Notification $notification the notification to be sent
  * @param NotificationContent $content the content
  * @return mixed
  */
 public function sendNotification(User $user, Notification $notification, NotificationContent $content)
 {
     $query = ParseInstallation::query();
     $query->equalTo('user_id', $user->id);
     $alert = $content->render('push_message', $notification);
     if (empty($alert) && !empty($notification->config['content_fallback_transport'])) {
         $alert = $content->render($notification->config['content_fallback_transport'], $notification);
     }
     $data = ['alert' => $alert, 'badge' => 'Increment'];
     $result = ParsePush::send(array('where' => $query, 'data' => $data));
     return is_array($result) && isset($result['result']) && $result['result'];
 }
コード例 #4
0
/**
Envia la notificacion a cierto usuario
**/
function enviarPush()
{
    $_strName = $_POST['nombreUsuario'];
    $_strMenssage = $_POST['send'];
    // Find users near a given username
    $userQuery = ParseUser::query();
    $userQuery->equalTo("username", $_strName);
    // Find devices associated with these users
    $pushQuery = ParseInstallation::query();
    $pushQuery->matchesQuery('Usuarios', $userQuery);
    // Send push notification to query
    ParsePush::send(array("where" => $pushQuery, "data" => array("alert" => "{$_strMenssage}")));
}
コード例 #5
0
function parse_push_notifications_send($message)
{
    //$data = array("alert" => $message);
    ParsePush::send(array("channels" => array("Ryan"), data => array("alert" => $message)));
    // Notification for iOS users
    //  $queryIOS = ParseInstallation::query();
    //  $queryIOS->equalTo('deviceType', 'ios');
    //  ParsePush::send(array(
    //    "where" => $queryIOS,
    //    "data" => array(
    //      "alert" => $message
    //    )
    //  ));
}
コード例 #6
0
 public function processNotifications($batch_size)
 {
     $notifications_repository = $this->notifications_repository;
     return $this->tx_manager->transaction(function () use($batch_size, $notifications_repository) {
         $qty = 0;
         $query = new QueryObject();
         $query->addAndCondition(QueryCriteria::equal('IsSent', 0));
         list($list, $size) = $notifications_repository->getAll($query, 0, $batch_size);
         // init parse ...
         ParseClient::initialize(PARSE_APP_ID, PARSE_REST_KEY, PARSE_MASTER_KEY);
         foreach ($list as $notification) {
             if (empty($notification->Message)) {
                 continue;
             }
             $message = array("data" => array('alert' => $notification->Message));
             // Push to speakers
             try {
                 switch ($notification->Channel) {
                     case 'SPEAKERS':
                         $message['channels'] = ['speakers'];
                         break;
                     case 'ATTENDEES':
                         $message['channels'] = ['attendees'];
                         break;
                     case 'MEMBERS':
                         $recipients = array();
                         foreach ($notification->Recipients() as $m) {
                             array_push($recipients, 'me_' . $m->ID);
                         }
                         $message['channels'] = $recipients;
                         break;
                     case 'SUMMIT':
                         $message['channels'] = ['su_' . $notification->SummitID];
                         break;
                     case 'ALL':
                         $message['where'] = ParseInstallation::query();
                         break;
                 }
                 ParsePush::send($message);
                 $notification->sent();
                 ++$qty;
             } catch (Exception $ex) {
                 SS_Log::log($ex->getMessage(), SS_Log::ERR);
             }
         }
         return $qty;
     });
 }
コード例 #7
0
ファイル: Push.php プロジェクト: urbanetter/parse-bundle
 /**
  * @param $data
  * @param null|array $channels
  * @param null|ParseQuery $where
  * @return mixed
  * @throws ParseException
  * @throws \Exception
  */
 public function send($data, $channels = null, ParseQuery $where = null)
 {
     $params['data'] = $data;
     /*
      * Check that $channels is a string or an array of strings
      * Check channel strings (no space)
      */
     if (null !== $channels) {
         if (!is_array($channels)) {
             throw new ParseException('$channels must be an array of strings');
         } else {
             $params['channels'] = $channels;
         }
     }
     if (null !== $where) {
         $params['where'] = $where;
     }
     return ParsePush::send($params);
 }
コード例 #8
0
 public function registerMultipleUsers()
 {
     $input = Input::all();
     //dd(Input::all());
     //$input = json_decode(Input::get('data'));
     //$input = json_decode($json);
     \Log::error($input);
     \Log::error($input['event']);
     $event_num = $input['event'];
     $names = $input['names'];
     //$event_num = $input->event;
     //$names = $input->names;
     //dd($event_num);
     for ($i = 0; $i < count($names); $i++) {
         \Log::error($names[$i]);
         $user = User::where('name', '=', $names[$i])->first();
         \Log::error($user);
         if (isset($user)) {
             $user->occasions()->attach($event_num);
             $user->save();
             $app_id = 'jVmr9Q4ItzKs2abze4T2mRvECJ8AxMwCKT5G8anC';
             $rest_key = 'hNv7GwawFKdvpyb6B6u8sLqlSQMW3YWWRQeKVll7';
             $master_key = 'wzwEOPsb5w45qWQQVJSCqTtL6yvD82Y90SiVDh4y';
             ParseClient::initialize($app_id, $rest_key, $master_key);
             $data = array("alert" => "You have been invited to an event! Press here to learn more.");
             $query = ParseInstallation::query();
             $query->equalTo("device_id", $user->id);
             ParsePush::send(array("where" => $query, "data" => $data));
             Twilio::message($user->phone, 'You have been invited to an event! Open up Calendr to learn more.');
             $data = array('temp');
             /*
             		Mail::send('emails.invite', $data, function($message) use ($user)
             		{
             			\Log::info($user->email);
             		    $message->to($user->email, 'Jane Doe')->subject('You have been invited to an event!');
             		});
             */
         }
     }
 }
コード例 #9
0
 public function notify($schedule, ChannelServiceProvider $channelService)
 {
     $key = \Config::get('site.cacheChannelsWithNotifications');
     $channels = \Cache::get($key, function () use($channelService) {
         return $channelService->getAllWithNotificationsAndConfig();
     });
     foreach ($channels as $channel) {
         $parseConfig = $channel->configs->count() ? $channel->configs : null;
         $notifications = $channel->notifications->count() ? $channel->notifications : null;
         if ($parseConfig == null || $notifications == null) {
             continue;
         }
         $parseConfig = $parseConfig->first();
         if (!$parseConfig->value['appKey'] || !$parseConfig->value['restKey'] || !$parseConfig->value['masterKey']) {
             continue;
         }
         foreach ($notifications as $notification) {
             //dd($parseConfig);
             $time = date("H:i", strtotime('-345 minutes', strtotime($notification->time)));
             $schedule->call(function () use($notification, $parseConfig) {
                 //sendNotification('test notification 1');
                 ParseClient::initialize($parseConfig->value['appKey'], $parseConfig->value['restKey'], $parseConfig->value['masterKey']);
                 $query = ParseInstallation::query();
                 $query->containedIn('channels', ['']);
                 //$types = ['live','latest','featured','popular','news'];
                 $not_data = [];
                 ParsePush::send(array("where" => $query, "data" => array("alert" => $notification->msg, "nitv_b_typeId" => $notification->type, "nitv_b_data" => $not_data)));
                 \Log::info(error_get_last());
             })->dailyAt($time);
         }
     }
     $days = [2, 4, 6];
     $schedule->call(function () {
         \Log::info('not received at ' . date('w i'));
     })->days($days)->at(date('h:i'));
 }
コード例 #10
0
ファイル: cpnpop_push.php プロジェクト: puuga/parse-php-push
require 'autoload.php';
use Parse\ParsePush;
use Parse\ParseUser;
use Parse\ParseInstallation;
use Parse\ParseClient;
$app_id = "ut71Hombs4drwmZCZ3Ez4cfU5fm19iiJkWSWe522";
$rest_key = "RffInDSP4HajHjIdp1xrPtkVphWxKaIKkmTba4q2";
$master_key = "x7V1uARnhcqc7TTILafCHvV0wZ8ECu66gu3A4gzN";
ParseClient::initialize($app_id, $rest_key, $master_key);
if (!isset($_GET["message"]) || $_GET["rlskey"] !== "VJwVicd") {
    $result["result"] = "fail";
    $result["reason"] = "invalid key or blank message";
} else {
    // get data from query string
    $rlskey = $_GET["rlskey"];
    $message = $_GET["message"];
    if (isset($_GET["title"])) {
        $title = $_GET["title"];
        $data = array("alert" => $message, "title" => $title);
    } else {
        $data = array("alert" => $message);
    }
    // send push
    ParsePush::send(array("channels" => [""], "data" => $data));
    $result["result"] = "success";
    $result["title"] = $title;
    $result["message"] = $message;
}
header('Content-Type: application/json');
echo json_encode($result);
コード例 #11
0
 public function pushToTimeZone($data)
 {
     $query = ParseInstallation::query();
     $query->equalTo("timeZone", $data["timezone"]);
     $data = array("alert" => $data["message"]);
     try {
         $send = ParsePush::send(array("where" => $query, "data" => $data));
         $return = array("Status" => "SUCCESS", "Data" => $data);
         return $return;
     } catch (ParseException $ex) {
         return $return = array("Status" => "FAILED", "Message" => $ex->getMessage(), "Code" => $ex->getCode());
     }
     return $send;
 }
コード例 #12
0
ファイル: init.php プロジェクト: raxjethvaa/HTML
        $user = ParseUser::logIn($results['results'][0]['username'], $results['results'][0]['passwordNew']);
        $userObject = new ParseObject("_User", $_GET['objectId']);
        $userObject->set("refemployerid", $dataObject['refemployerid']);
        $userObject->save();
        $returnData = json_encode(array("code" => 1));
        break;
    case "addEmployee":
        $dataObject = json_decode(file_get_contents("php://input"), true);
        $addEmployee = new ParseObject('Employers');
        $addEmployee->set("name", $dataObject['name']);
        $addEmployee->set("primaryColor", $dataObject['primaryColor']);
        $addEmployee->set("secondaryColor", $dataObject['secondaryColor']);
        $addEmployee->set("agencyId", $dataObject['agencyId']);
        $addEmployee->set("loginCode", $dataObject['loginCode']);
        $addEmployee->setArray("logo", $dataObject['logo']);
        $addEmployee->setArray("html_content", $dataObject['html_content']);
        $dataSuccess = $addEmployee->save();
        $returnData = '{"code":1}';
        break;
    case "push":
        $dataObject = json_decode(file_get_contents("php://input"), true);
        ParsePush::send($dataObject);
        $returnData = '{"code":1}';
        break;
    case "tynidata":
        $returnData['data'] = file_get_contents($_REQUEST['stringurl']);
        $returnData = json_encode($returnData['data']);
        break;
}
echo $returnData;
exit;
コード例 #13
0
ファイル: input_to_news.php プロジェクト: phakphumi/News
             }
         } catch (ParseException $ex) {
             // Execute any logic that should take place if the save fails.
             // error is a ParseException object with an error code and message.
             echo 'Failed to edit object, with error message: ' + $ex->getMessage();
         }
     } else {
         try {
             $saving->save();
             $savingLog->save();
             echo 'Object creath with objectId: ' . $saving->getObjectId();
             if ($_POST["priority"] == "true") {
                 // Notification for Android users
                 $queryAndroid = ParseInstallation::query();
                 $queryAndroid->equalTo('deviceType', 'android');
                 ParsePush::send(array("where" => $queryAndroid, "data" => array("alert" => $topic)));
             }
         } catch (ParseException $ex) {
             // Execute any logic that should take place if the save fails.
             // error is a ParseException object with an error code and message.
             echo 'Failed to edit object, with error message: ' + $ex->getMessage();
         }
     }
     echo "<br/><a href='./index.php'>Back</a>";
 } elseif ($_POST && $_POST["del"] == "true") {
     $dataDel = intval($_POST['postTS']);
     $delete = new ParseQuery("NEWS");
     $delete->equalTo("POST_TS", $dataDel);
     $deleteQuery = $delete->find();
     $deleteQuery[0]->set("DEL", 1);
     try {
コード例 #14
0
ファイル: index.php プロジェクト: arh922/ain
<?php

error_reporting(E_ALL);
ini_set('display_errors', '1');
include 'autoload.php';
use Parse\ParseObject;
use Parse\ParseQuery;
use Parse\ParseACL;
use Parse\ParsePush;
use Parse\ParseUser;
use Parse\ParseInstallation;
use Parse\ParseException;
use Parse\ParseAnalytics;
use Parse\ParseFile;
use Parse\ParseCloud;
use Parse\ParseClient;
ParseClient::initialize("mm6dXaFvCF0ADuhObiUnf9V1e9lbJpyutgJRhyOW", "fRZ9PkFKNfjcvbRKxzNAsB2bbLtezuRNmGwZIBQS", "JuGV1TojnASyPnjcChMUiNUSr3m2i2xMfyDChLnt");
$source_name = $_GET['source_name'];
$cid = $_GET['cid'];
$channel = $_GET['channel'];
$title = $_GET['title'];
$aid = $_GET['aid'];
$data = array('alert' => $source_name . " | " . mb_substr($title, 0, 120, "UTF-8"), 'sound' => 'push.caf', "badge" => "Increment", "title" => $source_name . " | " . mb_substr($title, 0, 120, "UTF-8"), "id" => $aid);
// Push to Channels
echo 'Breaking News(PN): <br /> <pre>';
print_R(ParsePush::send(array("channels" => [$channel], "data" => $data)));
コード例 #15
0
 /**
  * Send the push notification.
  *
  * @param PushNotification $push
  * @throws \Exception
  */
 public function send(PushNotification $push)
 {
     ParsePush::send($this->formatExternalPushData($push->getData()));
 }
コード例 #16
0
ファイル: sendmsg.php プロジェクト: lask20/ashi
    // $user = new ParseQuery("_User",$currentUser);
    // $user->equalTo("username", $currentUser->getUsername());
    // $locationObj = $user->find();;
    // $location = $locationObj;
    $location = $currentUser->get('location');
    $fullname = $currentUser->get('fullName');
    $query = ParseInstallation::query();
    //$query->equalTo("channels", "Giants");
    //$query->equalTo("scores", true);
    if (!empty($location)) {
        $sw = new ParseGeoPoint(floatval($location[1]->getLatitude()), floatval($location[1]->getLongitude()));
        $ne = new ParseGeoPoint(floatval($location[0]->getLatitude()), floatval($location[0]->getLongitude()));
        $query->withinGeoBox("location", $sw, $ne);
    }
    $query->containedIn("channels", array($_POST['priority']));
    ParsePush::send(array("where" => $query, "data" => array("badge" => "Increment", "alert" => $fullname . " : " . $_POST['message'])));
    $noti = new ParseObject("NotiData");
    $noti->set("message", $_POST['message']);
    $noti->set("priority", $_POST['priority']);
    $noti->set("user", $currentUser);
    $noti->set("fullName", $fullname);
    $noti->save();
}
?>
<!DOCTYPE html>
<!--
This is a starter template page. Use this page to start your new project from
scratch. This page gets rid of all links and provides the needed markup only.
-->
<html>
<head>
コード例 #17
0
ファイル: parseQuery.php プロジェクト: arh922/ain
<?php

error_reporting(E_ALL);
ini_set('display_errors', '1');
include 'autoload.php';
use Parse\ParseObject;
use Parse\ParseQuery;
use Parse\ParseACL;
use Parse\ParsePush;
use Parse\ParseUser;
use Parse\ParseInstallation;
use Parse\ParseException;
use Parse\ParseAnalytics;
use Parse\ParseFile;
use Parse\ParseCloud;
use Parse\ParseClient;
function pr($ar)
{
    echo '<pre>';
    print_R($ar);
    echo '</pre>';
}
ParseClient::initialize("mm6dXaFvCF0ADuhObiUnf9V1e9lbJpyutgJRhyOW", "fRZ9PkFKNfjcvbRKxzNAsB2bbLtezuRNmGwZIBQS", "JuGV1TojnASyPnjcChMUiNUSr3m2i2xMfyDChLnt");
$data = array('alert' => 'test' . " | " . mb_substr('test title', 0, 120, "UTF-8"), 'sound' => 'push.caf', "badge" => "Increment", "title" => 'test' . " | " . mb_substr('test title', 0, 120, "UTF-8"), "id" => 12);
$query = ParseInstallation::query();
$query->equalTo("channels", "a971");
$query->equalTo("keywords", "b1");
$query->limit(100000);
pr($query);
pr(ParsePush::send(array("where" => $query, "data" => $data)));
コード例 #18
0
 /**
  * @param $notification
  * @param $card
  * @param $balance
  *
  * @throws \Exception
  */
 private function sendNotificationPush($notification, $card, $balance)
 {
     $channelName = 'card_' . $card->number;
     $optimusId = app('optimus')->encode($notification->id);
     ParsePush::send(['channels' => [$channelName], 'expiration_interval' => $this->pushExpirationInterval, 'data' => ['card_balance' => number_format($balance->balance, 2), 'card_number' => $card->number, 'notification_id' => $optimusId]]);
 }
コード例 #19
0
    public function storeSchedule()
    {
        $input['json'] = '{
						    "user": "******",
						    "event": "1",
						    "time_slots": [
						        {
						            "start": 1411239474,
						            "end": 1411539474,
						            "weighting": "5"
						        },
						        {
						            "start": 1411269474,
						            "end": 1411549474,
						            "weighting": "5"
						        }
						    ]
						}';
        $decoded = json_decode($input['json']);
        $user_id = $decoded->user;
        $occasion_id = $decoded->event;
        // Get the occasion tied to the user
        $occasion = User::find($user_id)->occasions->find($occasion_id);
        if ($occasion == null) {
            return null;
        }
        $time_slots = $decoded->time_slots;
        $insert = array();
        for ($i = 0; $i < count($time_slots); $i++) {
            $start = $time_slots[$i]->start;
            $ts_start = Carbon::createFromTimeStamp($start);
            $end = $time_slots[$i]->end;
            $ts_end = Carbon::createFromTimeStamp($end);
            $insert[] = array('start' => $ts_start->toDateTimeString(), 'end' => $ts_end->toDateTimeString(), 'weighting' => $time_slots[$i]->weighting, 'user_id' => $user_id, 'occasion_id' => $occasion_id);
        }
        //dd($insert);
        Timeslot::insert($insert);
        $occasion->pivot->complete = 1;
        $occasion->pivot->save();
        $num_incomplete_occasions = Occasion::find($occasion_id)->users()->wherePivot('complete', 0)->count();
        if ($num_incomplete_occasions != 0) {
            return $occasion;
        }
        // The events are done - push
        $occasion = Occasion::find($occasion_id);
        $host_start = new Carbon($occasion->start);
        $host_end = new Carbon($occasion->end);
        $diff = $host_start->diffInMinutes($host_end);
        $num_users = $occasion->users->count();
        $score = array();
        $score = array_fill(0, 10000, 0);
        //$score[0] = 'test';
        //$score = 0;
        $k = 0;
        $previous = new Carbon($occasion->start);
        // implement eager loading
        for ($i = 0; $i < $diff; $i += 15) {
            for ($j = 0; $j < $num_users; $j++) {
                $start = new Carbon($occasion->start);
                $start->addMinutes($i);
                $timeslot = Timeslot::where('user_id', '=', $j)->where('start', '<=', $previous->toDateTimeString())->where('end', '>=', $start->toDateTimeString())->first();
                if ($timeslot != null) {
                    //dd($timeslot);
                    //$score = array_add($score, $i, $timeslot->weighting);
                    $score[$i] += $timeslot->weighting;
                    //$score[$i] += $timeslot->weighting;
                    //$score[] = array($timeslot->weighting);
                    //$k++;
                    //var_dump($score);
                }
            }
            $previous = $start;
        }
        $score = array_filter($score);
        //dd($score);
        rsort($score);
        $top3 = array_reverse(array_slice($score, 0, 3));
        $users = Occasion::find($occasion_id)->users()->get();
        $data = array('temp');
        $users = $users->each(function ($user) use($data) {
            \Mail::send('emails.invite', $data, function ($message) use($user) {
                $message->to($user->email, $user->name)->subject('Your event has been scheduled!');
            });
            \Twilio::message($user->phone, 'An event has finished scheduling! Open up Calendr to learn more.');
        });
        $app_id = 'jVmr9Q4ItzKs2abze4T2mRvECJ8AxMwCKT5G8anC';
        $rest_key = 'hNv7GwawFKdvpyb6B6u8sLqlSQMW3YWWRQeKVll7';
        $master_key = 'wzwEOPsb5w45qWQQVJSCqTtL6yvD82Y90SiVDh4y';
        ParseClient::initialize($app_id, $rest_key, $master_key);
        $data = array("alert" => "An event has finished scheduling! Press here to learn more.");
        ParsePush::send(array("channels" => ["PHPFans"], "data" => $data));
        $query = ParseInstallation::query();
        $query->equalTo("design", "rad");
        ParsePush::send(array("where" => $query, "data" => $data));
        //	dd($score);
    }
コード例 #20
0
 public function testPushDates()
 {
     ParsePush::send(array('data' => array('alert' => 'iPhone 5 is out!'), 'push_time' => new DateTime(), 'expiration_time' => new DateTime(), 'channels' => array()));
 }
コード例 #21
0
ファイル: ParsePushTest.php プロジェクト: louk/One-Nice-Thing
 public function testPushDates()
 {
     ParsePush::send(['data' => ['alert' => 'iPhone 5 is out!'], 'push_time' => new DateTime(), 'expiration_time' => new DateTime(), 'channels' => []]);
 }
コード例 #22
0
function send_push_parse_callback()
{
    check_ajax_referer('pp-super-security-string', 'security');
    $message = sanitize_text_field($_POST['message']);
    $data = array('data' => array('alert' => $message));
    $app_id = esc_attr(get_option('pp-application_id'));
    $rest_key = esc_attr(get_option('pp-rest_api_key'));
    $master_key = esc_attr(get_option('pp-master_api_key'));
    ParseClient::initialize($app_id, $rest_key, $master_key);
    if (isset($_POST['scope']) and $_POST['scope'] != '' || $_POST['scope'] != 'all') {
        $scope = sanitize_text_field($_POST['scope']);
        $query = ParseInstallation::query();
        $query->equalTo('deviceType', $scope);
    }
    if (isset($_POST['channels']) and $_POST['channels'] != '') {
        $channels = sanitize_text_field($_POST['channels']);
        if (!isset($query)) {
            $query = ParseInstallation::query();
        }
        $query->equalTo('channels', $channels);
    }
    if (isset($query)) {
        $data['where'] = $query;
    }
    try {
        $result = ParsePush::send($data);
    } catch (ParseException $error) {
        status_header(500);
        $response = array('code' => $error->getCode(), 'message' => $error->getMessage());
        wp_send_json($response);
    }
    $res = $result;
    status_header(200);
    wp_send_json($res);
}
コード例 #23
0
 public function postPush()
 {
     ParseClient::initialize(Config::get('parse.app_id'), Config::get('parse.rest_key'), Config::get('parse.master_key'));
     //ParseClient::initialize('lNz2h3vr3eJK9QMAKOLSaIvETaQWsbFJ8Em32TIw', '8QQoPiTZTkqSMkYLQQxHiaKBXO6Jq7iD2dCJjGUz', '2bKlPqYIKMpW1rJOdpBXQ8pf7cMXxGaFKrCXMr19');
     $message = Input::get('message');
     $title = Input::get('title');
     $device_name = Input::get('device_name');
     $device_key = Input::get('device_key');
     $parse_installation_id = Input::get('pinstall');
     try {
         $pushQuery = ParseInstallation::query();
         if ($parse_installation_id != '') {
             $pushQuery->equalTo('installationId', $parse_installation_id);
             ParsePush::send(array('where' => $pushQuery, 'data' => array('alert' => $message, 'title' => $title, 'device_name' => $device_name, 'device_key' => $device_key)));
         } else {
             $pushQuery->equalTo('deviceType', 'android');
             ParsePush::send(array('where' => $pushQuery, 'data' => array('alert' => $message, 'title' => $title, 'device_name' => '', 'device_key' => '')));
         }
         return Response::json(array('result' => 'OK'));
     } catch (Exception $e) {
         return Response::json(array('result' => 'NOK', 'err' => $e));
     }
 }
コード例 #24
0
ファイル: test.php プロジェクト: jerryamatya/broadcaster
<?php

use Parse\ParseClient;
use Parse\ParsePush;
require 'autoload.php';
$android = ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
date_default_timezone_set('UTC');
//ParseClient::initialize(
//'SVybRISVg4pUS0jciWYkZH5CSTyPaXAXvdWZjCu6',
// 'JthZqiVHiZ2BEEkwxWB2ltriJjmay3z7TRSS6KX5',
// 'RH4pRDW25piAJsMUEx3uduzvbSu2t9h37se77mNn'
//);
ParseClient::initialize('fPSUGZ0H5wm7UPgcEYQ3EImEgv3HuidGeFXFDDJw', '6VIhRzVVQN8oBsYjbZ2SYCmBzEqK4C499o4Q25KD', 'c6akmuK1fHz8RcYuwn6bh5EhaXvqeeZdezc6xbpj');
ParsePush::send(['channel' => ['broadcast'], 'data' => ['alert' => 'sample message']]);
echo "success";
print_r(error_get_last());