SMS Component
A simple and free SMS gateway component based on the information provided in http://en.wikipedia.org/wiki/List_of_carriers_providing_SMS_transit. This component aims to be as easy as the Email component but for text messages.
SMS Component
Version 1.0
Author: Nick Baker (nick [at] webtechnick [dot] com)
Website: http://www.webtechnick.com
Browse, Download, or Checkout the Component.
Browse: http://projects.webtechnick.com/sms_component
Download: http://projects.webtechnick.com/sms_component.tar.gz
SVN: svn co http://svn2.xp-dev.com/svn/nurvzy-sms-component
Code: Page 2: SMS Component Code
I suggest reading the README.txt file included within the component. Installation is very straight forward.
This component is in beta and only tested with Sprint, AT&T, and VerizonWireless as those are the only carriers I have access to. I have no reason to believe the other carriers wont work, I just haven't been able to test them yet. If you're willing to help, please let me know via email, a comment on this article, or on my site: http://www.webtechnick.com/
INSTALL:
1) Move the sms.php into your /app/controllers/components/ directory
2) Add Sms to the component list in the controller you want to use it in
Example:
USAGE:
You use the Sms component much like you would the Email component.
Example:
Or you can pass in these properties as an options array.
Example2:
TESTING SMS component:
The SMS component has a built in testSend feature that will test if the SMS is ready to be sent or not.
Current Carrier String List:
Download code
I've picked out the most common carriers in my area and for my own purposes, but its very easy to add more to the list via carrierDomain associative array.
Then you could reference you're new carrier like so:
I hope you find this component useful. If you like the component, find a bug, or have a feature request please post a comment.
Thanks,
Nick
Version 1.0
Author: Nick Baker (nick [at] webtechnick [dot] com)
Website: http://www.webtechnick.com
Browse, Download, or Checkout the Component.
Browse: http://projects.webtechnick.com/sms_component
Download: http://projects.webtechnick.com/sms_component.tar.gz
SVN: svn co http://svn2.xp-dev.com/svn/nurvzy-sms-component
Code: Page 2: SMS Component Code
I suggest reading the README.txt file included within the component. Installation is very straight forward.
This component is in beta and only tested with Sprint, AT&T, and VerizonWireless as those are the only carriers I have access to. I have no reason to believe the other carriers wont work, I just haven't been able to test them yet. If you're willing to help, please let me know via email, a comment on this article, or on my site: http://www.webtechnick.com/
INSTALL:
1) Move the sms.php into your /app/controllers/components/ directory
2) Add Sms to the component list in the controller you want to use it in
Example:
Controller Class:
Download code
<?php var $components = array('Sms');?>
USAGE:
You use the Sms component much like you would the Email component.
Example:
Controller Class:
Download code
<?php
$this->Sms->number = '5551234567'; //10 digit cellphone number
$this->Sms->carrier = 'Sprint'; //carrier string
$this->Sms->from = '5553331111'; //10 digit cellphone number OR email address
$this->Sms->text = 'This is a text message'; //Body of text message.
$this->Sms->send(); //Actually send the text message.?>
Or you can pass in these properties as an options array.
Example2:
Controller Class:
Download code
<?php $this->Sms->send(array(
'number' => '5551234567', //10 digit cellphone number
'carrier' => 'Sprint', //carrier string
'text' => 'This is a text', //Body of the text message
'from' => '5553331111' //10 digit cellphone number OR email address
));?>
TESTING SMS component:
The SMS component has a built in testSend feature that will test if the SMS is ready to be sent or not.
Controller Class:
Download code
<?php
if($this->Sms->testSend()){
//Hurray, we can send it!
$this->Sms->send();
} else {
//Oh no, can't send it, check the errors log to see why
debug($this->Sms->errors);
}
?>
Current Carrier String List:
Download code
'ATT' //AT&T
'Boost' //Boost Mobile
'Cellular One' //Cellular One
'Cingular' //Cingular
'Cricket' //Cricket
'Nextel' //Nextel
'Sprint' //Sprint
'Qwest' //Qwest
'TMobile' //T-Mobile
'Verizon' //Verizon Wireless
'Virgin' //Virgin Mobile
I've picked out the most common carriers in my area and for my own purposes, but its very easy to add more to the list via carrierDomain associative array.
Controller Class:
Download code
<?php
function beforeFilter(){
$this->Sms->carrierDomain['NewCarrier'] = 'new.carrier.domain.com';
parent::beforeFilter();
}
?>
Then you could reference you're new carrier like so:
Controller Class:
Download code
<?php
$this->Sms->carrier = 'NewCarrier';
$this->Sms->number = '5555551234';
$this->Sms->text = 'This is a text message to NewCarrier';
$this->Sms->send();
?>
I hope you find this component useful. If you like the component, find a bug, or have a feature request please post a comment.
Thanks,
Nick
Comments
Comment
1 You should think about using this
QuickSMS
A quick look at that file, and you'll be able to complete this component I think.