You are here

Simple PHP script to send Android Push Notification, iOS Push Notification and Windows Phone 8 Push Notification

PushNotifications.php <?php // Server file class PushNotifications { // (Android)API access key from Google API’s Console. private static $API_ACCESS_KEY = ‘AIzaSyDG3fYAj1uW7VB-wejaMJyJXiO5JagAsYI’; // (iOS) Private key’s passphrase. private static $passphrase = ‘joashp’; // (Windows Phone 8) The name of our push channel. private static $channelName = “joashp”; // Change the above three vriables as per your app. public function __construct() { exit(‘Init function is not allowed’); } // Sends Push notification for Android users public function android($data, $reg_id) { $url = ‘https://android.googleapis.com/gcm/send’; $message = array( ‘title’ => $data[‘mtitle’], ‘message’ => $data[‘mdesc’],…

Read More

iOS Push Notifications with PHP

Introduction Sending notifications to an iOS Application can enhance the experience exponentially for users, also it allows you to deliver key data easily. However, actually sending the push notification to users can be a bit tedious at times, and at times confusing. You need to ensure that you pack your integers, and times correctly – failing to do this and you’ll probably get an unhelpful status from Apple. The APNS Using the APNS (Apple Push Notification Service) requires a bit of pre-configuration initially, you’ll need to download some certificates from…

Read More