Sending Push Notifications on iOS using APNS & PHP
APNS or Apple Push Notification Service, is service for Apple devices like iPhone, iPad & iPod to send 3rd party notifications to devices. It was launched with iOS version 3.0, it's very helpful for the app developers as they do not have to frequently poll for updates, instead they can submit the notification to APNS and device when online will fetch the notification and alert the user. This removes the need for the app to run on the device all the time to receive updates, and the user can also control what app's notifications they would like to receive and what they do not want.
In this article we will look at sending a notification to the APNS using PHP. You'll need the certificate from your Apple Developer console for your app. And EnTrust CA file which can be fetched from https://www.entrust.net/downloads/bi...st_2048_ca.cer
The APNS has it's own binary protocol which is quite simple, the structure of a tuple/record/message is like this:
Sample JSON payload for notification:
Now, here's how we are going to send the notification using PHP:
I hope the article was helpful.
|All times are GMT +5.5. The time now is 00:57.|