PHP SMS Gateway
As part of a project to publish SMS to a phpBB2 modified bullettin board, I did develop a php SMS Gateway. It was written and tested with a MC35i Siemens GSM Box, but following the GSM 07.05 specs should work with a number of other GSM devices. A serial connection is used so the communitacion happens with AT Commands. In the two files included the “glue code” to work with a phpBB2/Mysql database is included, but is very easy to recycle the code needed for the communication (as soon as I have a bit of time, I will extract a phpBB2-free version).
php_main.php: is the command line code, it contains documentation on how to use it but basically after a few test I found useful to rely on a cron script (containing a line like: #cat /dev/ttyS0 > /tmp/from_ttyS0.txt) that redirect all coming from the COM port (here supposed to be /dev/ttyS0, adjust in case if ttyS1 or anything else) to a file, that is then read by PHP.
php_utils.php: is included by php_main.php and includes all the tools to work on SMS once received by the device. Some code is relative to phpBB2, but a common functionality is to insert and entry in a MySQL DB containing all the info about the message. Tune the SQL following your need (remember this code was working in touch with a hacked phpBB2 v2.0.19, so configuration, MySQL connection was is related to it)
Other related:
- MC35i AT Command Set (mc35i_atc_v0102a.pdf)