tags:

views:

37

answers:

1

Can anyone send me the code to send SMS(short Message Service) via php. Thanks in Advance.

Regards, Chandru

+1  A: 

The easiest way to do this is by sending an e-mail to the mobile provider's SMS e-mail gateway. This will change with every provider, so you will have to ask your users what their provider is.

Here is a list of all providers and their corresponding SMS email addresses: http://sms411.net/how-to-send-email-to-a-phone/

Afterward, you would just send a mail through PHP accordingly:

 // Let us assume for this example that we are on AT&T
 $to = "[email protected]";         // Ten digit phone number
 $subject = "You've got a new message in your mailbox!";
 $body = "A new message has been sent to you on MyWebsite. Please check it out!";
 $from = "MyWebsite <[email protected]>";

 Mail($to, $subject, $body, "From: $from");

And that should do it.

There are more complicated ways to send SMS messages via an API instead of e-mail, but almost all of these are pay-for services. You can search Google for SMS gateway providers for more information.

rakuo15
Here in Europe, this method usually has to be manually activated by the recipient, and receiving a message this way often costs them as much as sending one from their own phone. Not sure in which situations this will work.
Pekka
i have SMS gateway account to send.i searched for php code. can u refer me the code to send sms with sms gateway
chandru
It really depends on what kind of gateway you have an account with. I suggest you ask another question with all the information, including the service you are using, so that we can help you out better.
rakuo15