How to send sms by connecting a phone to a Ubuntu machine? [closed]
I am writing a PHP script from which I want to send sms.
I know smsgateways are easy and cheap. But somehow we are planning to attach a cell phone to the machine and send sms using that phone.
Any ideas how to do it with php and linux?
I don't know about PHP, but I've been using SMSLib (http://smslib.org/) with Java and Ubuntu for a long time and it's been quite easy. It took me half a day or so to send SMS with it.
They have a Java
API and an .NET
API that is not perfectly supported.
You can use most phones that you can connect as a modem to your ubuntu machine. They communicate through the /dev/ACM
serial ports and AT-commands
.
There is a large list of compatible phones on their site (http://smslib.org/doc/compatibility/), but you should just try it. My old Motrola V3 wasn't in the list back then too ;)
Typically, you would use special hardware for this, rather than just any old phone.
You can buy dedicated SMS gateway devices which plug into a PC or server and take a SIM card. These would typically come with bundled driver software which would provide an API for you to use in various languages.
Googleing for "SMS hardware" brings up a whole raft of options. This one turns up top of the list: http://www.smsfoxbox.com/ but there are plenty of others there too.
Most mobile phones which will talk to a computer directly support the Nokia extensions to the Hayes AT command set. (lots more reference material on Google).
The big problem you will run into is that you need dedicated access to the serial port for the duration of te operation (so calling the device from a web page is a no-no). I've previously used BSD lpd to queue messages which were then handled via smssend, but you could just write a dedicated daemon e.g. polling a mailbox.
精彩评论