This site is meant to provide free html website templates and conversion to free Joomla templates and Basic How to.

Tuesday, December 9, 2008

SMS Functionality

We did manage to use PHP to send sms using WAMP Joomla Server. For those who are interested, we use a facileform to create the joomla interface, I define phpSerial class in the facileform.process.php which can be called by the created form. You can create your own extension if you feel like it :). and you can get the phpSerial class that I use here => phpSerial

On form submission we run this chunk of code :

//Define String to send, use chr(13) for line feed
sms = "title".chr(13)."description";

//Require php Serial Class
$serial = new phpSerial;

//Open up connection to the GSM Modem
$serial->deviceSet("COM5");
$serial->deviceOpen();

//send command to GSM Modem, chr(26) is carriage return where the message ends.
$serial->sendMessage("at+cmgs=\"+6598776625\"\r\n",1);
$serial->sendMessage($sms.chr(26));

//release and close the device
$serial->deviceClose();


That's all for sending sms in Windows, you can retrieve data from database and put it into the string to send as sms too.
As for receiving sms, we fail to execute it in Windows using phpSerial. Instead we use Java to retrieve the sms and store to the joomla content database. Take a look here => http://smslib.org