How to send SMS messages from a server

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


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.


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.