$webPush = new WebPush(array('GCM' => $push_api)); $endpoints = get_endpoints("Voting_End30"); // send multiple notifications foreach ($endpoints as $endpoint) { $webPush->sendNotification($endpoint['Endpoint']); } $webPush->flush(); } if (in_array("Voting_End", get_event(3600))) { $to = get_emails("Voting_End60"); $message = ' <html> <body> <p>Dear HiveMember,</p> <p>You are yet to vote for this weeks film night. Voting closes in an hour. <p>Please <a href="https://films.jakestockwin.co.uk/voting.php">click here</a> to vote</p> <br> <p>Best wishes,<br>The HiveBot™</p> </body> </html> '; mail($to, "Film Night Voting", $message, "Content-type:text/html"); $webPush = new WebPush(array('GCM' => $push_api)); $endpoints = get_endpoints("Voting_End60"); // send multiple notifications foreach ($endpoints as $endpoint) { $webPush->sendNotification($endpoint['Endpoint']); } $webPush->flush(); } }