18

I want to send SMS messages to multiple numbers in my database based on an event happening. I was wondering if there is a way of doing this in PHP or Javascript? Maybe there is a function like php's mail function?

If not does anyone know of any good and easy to implement systems paid or free?

I'd like to have a go at developing something like this myself, but have a feeling that it might take me a long time.

Any other information or tips on the subject would be greatly appreciated.

Thanks for the time.

Oh, also I'm using Ubuntu server if that helps.

Brendan
  • 175
  • 2
  • 15
ragebunny
  • 1,582
  • 10
  • 33
  • 53
  • If this is a feature for a business, just find yourself a company that provides the service. There should be loads out there where you can just use their api (REST probably?) to send an sms for a minor fee. I'm using a dutch provider you probably can't use, so just google for service providers that can help you. No need for you to be messing with soft- and hardware? – Nanne Apr 03 '12 at 09:58
  • 1
    possible duplicate of [how to send sms programmatically?](http://stackoverflow.com/questions/1061752/how-to-send-sms-programmatically) – Quentin Apr 03 '12 at 09:59
  • See also [How to add SMS text messaging functionality to my website?](http://webmasters.stackexchange.com/questions/533/how-to-add-sms-text-messaging-functionality-to-my-website) (on W.SE) – Matt Apr 03 '12 at 10:00
  • And http://stackoverflow.com/questions/2177308/sending-an-sms-myself – David Mulder Apr 03 '12 at 10:00
  • Thanks @Quentin did should up when i typed the question – ragebunny Apr 03 '12 at 10:18
  • Possible duplicate of [How to programmatically send SMS on the iPhone?](http://stackoverflow.com/questions/10848/how-to-programmatically-send-sms-on-the-iphone) – Jonathan.Brink Feb 07 '16 at 02:22

3 Answers3

11

There is no function in PHP or javascript that can send sms directly. SMS are basically based on Short Message Peer-to-Peer (SMPP) protocol so there is no way you can directly send sms programmatically. Yes you could use smsgateway or an existing api where you can make a http request from php. There are lot of sms service providers like VAS providers and there are lot of free and open source smsgateway like kannel which you can use to send/recieve sms or if you could configure your own gateway as well.

Cave Johnson
  • 6,499
  • 5
  • 38
  • 57
ro ko
  • 2,906
  • 3
  • 37
  • 58
9

You typically use an SMS gateway to do this. There are many out there, google. Those offer an API of some sort (REST, SOAP, whatever) that you can make a request to. The gateway service will then send out the SMS message over the phone network. These services are typically paid for.

For very limited scenarios that only need to support certain carriers, you can often get away with sending a regular email to a special address, like [phonenumber]@carrier.com. Not all carriers support this though.

deceze
  • 510,633
  • 85
  • 743
  • 889
2

You can use a SMS gateway provider or setup your own gateway.

tonymarschall
  • 3,862
  • 3
  • 29
  • 52
  • 2
    the page changed :( I was rather interested in the guide to set up my own gateway. – isaaclw May 19 '16 at 17:48
  • https://web.archive.org/web/20121026124509/http://www.x11.net/wiki/index.php/Setting_up_an_SMS_Gateway should help. At least for above link. I am sure there is newer learning material over at google. – tonymarschall May 20 '16 at 19:41