PHPASPSMS

Copyright (C) 2002-2006 Oliver Hitz

Introduction

The SMS class provides a simple way to create a Web-based SMS gateway using the aspsms.com SMS service.

License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Requirements

This program requires a web server with PHP 4 and XML support.

Usage

In order to use the SMS class, you need to have an account at aspsms.com. You also need to make sure that your web server is able to access xml1.aspsms.com and xml2.aspsms.com on ports 5061 and 5098. By default, all IP addresses are able to access these servers. However, you can restrict the addresses that are able to connect using your username and password on the aspsms.com web site. Also make sure that traffic originating from your web server is not blocked by firewalls or other filters.

Once you have your username, password and a confirmation that your IP address is able to access the SMS gateway, our SMS class is very easy to use:

      <?php
      require("./php/SMS.inc");
      $sms = new SMS("username", "password");
      $sms->setOriginator("...");
      $sms->addRecipient("...");
      $sms->setContent("An SMS message.");
      $result = $sms->sendSMS();
      if ($result != 1) {
        $error = $sms->getErrorDescription();
      }
      ?>
    

The constructor creates a new SMS object using your personal username and password (received from aspsms.com). The string set by setOriginator is your phone number or your name (since this string is not verified by the aspsms service, you may start to mistrust the sender of messages...). You can then add recipients' phone numbers with the addRecipient method. Note that the phone numbers are international numbers, including the country code. The setContent method sets the message to send (160 characters max.) and sendSMS finally sends the message to the recipients.

A simple index.php for testing the class is provided in the archive.

Other Features

The SMS class also offers access to the following extended features offered by aspsms.com:

Delivery Status Notification

aspsms.com supports delivery status notification that lets you know if a message has been delivered to a recipient or not. As soon as the status of a message changes (e.g. when it is sent to the recipient), the aspsms.com server notifies you by calling a specific URL.

In order to use delivery status notifications using PHPASPSMS, the following needs to be done:

Although this is not documented in the official documentation of the aspsms.com XML Interface, the following placeholders will be replaced inside a URL:

For a comprehensive list of "Reason code" and "Delivery status", please refer to the ASPSMS Documentation. Please note that if no <TRN> is given in the URL, the unique identifier will be appended to the URL.

Acknowledgements

The delivery status notification feature in the PHPASPSMS script was sponsored by Reto Waldvogel of Europlink. Thanks!

The Nagios wrapper scripts in the /contrib directory were contributed by Daniel Lorch. Thanks!

Iwan Schmid contributed the "DeferredDeliveryTime" functionality. Thanks!

About aspsms.com

Please note that net-track GmbH is NOT affiliated with aspsms.com.

$Id: README.html,v 1.3 2007-09-18 14:23:16 oli Exp $