https://github.com/geerlingguy/celltrust-php
CellTrust PHP
https://github.com/geerlingguy/celltrust-php
api celltrust flocknote library php sms
Last synced: about 1 year ago
JSON representation
CellTrust PHP
- Host: GitHub
- URL: https://github.com/geerlingguy/celltrust-php
- Owner: geerlingguy
- License: mit
- Created: 2013-02-05T16:38:13.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2013-04-04T17:31:15.000Z (about 13 years ago)
- Last Synced: 2025-02-10T18:11:18.402Z (over 1 year ago)
- Topics: api, celltrust, flocknote, library, php, sms
- Size: 113 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# CellTrust-PHP
CellTrust PHP was originally written to integrate CellTrust's SMS messaging API
for [Flocknote](http://www.flocknote.com) by Jeff Geerling.
CellTrust has a REST API that is used for sending and receiving messages, but I
couldn't find any helpful PHP documentation or pre-existing libraries, so I
wrote this class.
## Usage
This code only implements bits of the CellTrust public messaging API (and not
the private messaging API, since I don't need to use it). Sending and receiving
messages is a simple affair:
### Sending a message
```php
// To send a message, create an instance of the class with your username and
// password, then set your message/keyword parameters, and send the message.
$sms = new CellTrust('myusername', 'mypassword');
$sms->setKeyword("mykeyword");
$sms->setShortcode(00000);
$sms->setMessage("My message here.");
$sms->setPhoneNumber("13145556666");
$sms->setPhoneCarrier(2);
$sms->sendSMS();
```
### Receiving a message
```php
// To receive a message, get the data delivered to your server, create an
// instance of the class with your username and password, then parse the
// data from CellTrust.
$input = file_get_contents('php://input'); // Get CellTrust request.
$sms = new CellTrust('myusername', 'mypassword');
$sms->parseIncomingSMS($input);
// Use getReceivedData() to return entire array of parameters received from
// CellTrust.
$received_data = $sms->getReceivedData();
// You can also retrieve received data granularly.
$message = $sms->getData(); // getMessage() and getData() may be different.
```
## License
CellTrust-PHP is licensed under the MIT (Expat) license. See included LICENSE.md.