1

How can I use a php script to push to an iphone or android phone?

What I am thinking right now is to have a php script that will run every 15 minutes on a web server, check if case x is satisfied, if not push a notification to the phone.

How can this be accomplished if its even possible? If not what approach should I take to achieving this? Any links or break downs would be greatly appreciated.

zafrani
  • 4,030
  • 5
  • 31
  • 39

4 Answers4

3

Instead of reinventing the wheel, how about using an existing tool such as Urban Airship? They provide a PHP library as well as a super-simple example using PHP's libcurl.

Matt Ball
  • 354,903
  • 100
  • 647
  • 710
  • Last time I looked it up, it required a 3rd party app as well which is an approach my team wanted to see if we could do with out – zafrani Dec 12 '11 at 19:56
1

If you want to setup your own server for push notifications, you should take a look at Easy APNS. It's a PHP library for push notifications which is very easy to set up and customize.

simonbs
  • 7,932
  • 13
  • 69
  • 115
  • Thank you, would this work for android as well? I only see iOS on it – zafrani Dec 12 '11 at 19:58
  • Ups, I'm sorry. I totally missed that you wanted to push to Android phones to. As far as I know, Easy APNS only works for iOS. – simonbs Dec 12 '11 at 19:59
1

Android Cloud to Device Messaging Framework is used to push notifications to Android devices. You can develop server part yourself or use existing service such as Urbanairship. It allows you to send pushes to both Android and iPhone but you'll have to pay for it.

k_shil
  • 2,108
  • 1
  • 20
  • 25
1

If you want to send the notifications yourself, you'll need to read up on sending push notifications to each platform. This SO question (and answer) address sending notifications on Android. This article is one of many in addition to Apple's docs that explain the process for iOS. If you use a third party service like Urban Airship, you'll need to look at that API instead.

Community
  • 1
  • 1
Caleb
  • 124,013
  • 19
  • 183
  • 272