开发者

php script for sms facility

开发者 https://www.devze.com 2023-01-28 13:54 出处:网络
I\'m making a project in my college, and I am making a web application. This web application is in openSuse. So the OS is Linux and I\'m writing the code in php.

I'm making a project in my college, and I am making a web application. This web application is in openSuse. So the OS is Linux and I'm writing the code in php.

Now I want scripts in php for including sms facility in my project. So I need full information how to go abou开发者_运维问答t it and what code to implement


You need to use an online SMS provider. A quick trip to google brought up this: http://www.messagemedia.co.uk/sms-gateways.html (UK only, search in your country to find one that'll work for you). Then go to their API page and they should give you a nice PHP API to use.


Two basic approaches

  • Use an online SMS provider, as suggested by many other comments
  • Use a GSM modem with software like Gammu to handle sending and receiving text messages; almost any USB GSM dongle can handle this.


If I were to do something like this, I would just use the mail() function of PHP.

In the US at least, I think all phone numbers have an email address:

19999999999@sub.carrier.com

If you can extract the carrier from the number, you could just strip all non-numeric characters from the number and use the PHP mail function to send an email to that address, which in turn is a text message. This is how I forward emails via text to my feature phone (funny, the name is misleading).

There are a number of sites that extract information from the number, but I couldn't find an explicit algorithm. Here's one (I bet you could just use file_get_contents() on that webpage to get the carrier): http://fonefinder.net/

It's not too complicated, so have fun!


Have you seen http://www.twilio.com?

It's really cheap and incredibly easy to use. Why reinvent the wheel? :)


Depends on your needs. If you need to send AND receive and be able to process the incoming messages you are going to need more than just a simple SMS provider and are going to need somebody to partition a short/long code (I'm assuming you don't want to spend 1000$/month on a Short Code) to process incoming messages and forward them to you. You can set up keywords, or regular expressions that get run on messages then forwarded to your server.

If you are just going to be using just outbound SMS (notifications, etc.) than you can use something simple like Clickatell or Twilio.

0

精彩评论

暂无评论...
验证码 换一张
取 消