logalertlast("alert already written"); return; // if already written } // write it to file, and log it $fh = fopen($alertfile, 'w'); fwrite($fh, $alertstring); fclose($fh); // log it $fhl = fopen($alertlog, 'a'); fwrite($fhl, date("Y/m/d H:i:s") . "|" . $alertstring . "\n"); fclose($fhl); echo "wrote to file: " . $alertstring; logalertlast("wrote to alert file"); // now send alert using Pushbots and Google Cloud Messaging PushANotification($alerthr . $alertmin . $alertam . " " . $title); exit(0); ///////////////////////////////////////////////////////////////// // ClearAlertFile - writes an empty string to the alert file // function ClearAlertFile($alertfile, $alertlog) { $DefaultMessage = ""; $DefaultMessage = "<span style='color:black;'>8/22: Both ferry lane webcams are now UP.</span>"; logalertlast("cleared alert file"); $alc = file_get_contents($alertfile); //if($alc=="") return; // if already empty if ($alc == $DefaultMessage) { return; } // if already empty
<?php PushANotification("this is a push message test"); function PushANotification($note) { // Push The notification with parameters require_once 'PushBots.class.php'; $pb = new PushBots(); // Application ID $appID = '570ab8464a9efaf47a8b4568'; // Application Secret $appSecret = '297abd3ebd83cd643ea94cbc4536318d'; $pb->App($appID, $appSecret); // Notification Settings $pb->Alert($note); $pb->Platform(1); // android // Push it ! $res = $pb->Push(); echo $res['status']; echo $res['code']; echo $res['data']; }