SMS Web Sender
Instance of this class should be used to handle SMS requests.
Located in Program_Root/SMS_Web_Sender.php (line 36)
Add site
Example:
1 $sws->add_site('sitename', 'login_user', 'login_pass');
2 $sws->add_site('site2', 'user2', 'pass2');
Add sites
$sites should be an indexed array holding associative arrays, Example:
This is equivalent to:
1 $sites = array();
2 $sites[] = array('name'=>'sitename', 'user'=>'login_user', 'pass'=>'login_pass');
3 $sites[] = array('name'=>'site2', 'user'=>'user2', 'pass'=>'pass2');
4 $sws->add_sites($sites);
The last method is preferred as add_site() returns true/false to indicate if site has been added successfully.
1 $sws->add_site('sitename', 'login_user', 'login_pass');
2 $sws->add_site('site2', 'user2', 'pass2');
indexed array holding associative arrays
Add site object
This method should be used if the site you want to add is not available in one of the relevant site folders, or if the site object should be configured in a special way before being used.
Note:
must be a subclass of SMS_Site
Get error
This method should be called if send() fails. The last site to have attempted the send should hold a suitable error message which will be returned by this method.
Get error number
This method should be called if send() fails. The last site to have attempted the send should hold a suitable error number which will be returned by this method. To check the returned error number, you can use the SMS Web Sender error constants. Example:
Usually the error message produced by get_error() will be fine to display to users, but to determine the reason in code you can use this method and compare against the error constants.
1 $error = $sws->get_error_number();
2 if ($error == SWS_ERR_QUOTA) {
3 // not enough quota to send
4 }
Note: this method will always return one of the SWS_ERR_* constants, if the error number is unrecognised SWS_ERR_UNKNOWN will be returned. So only call this when you know there's been an error.
Get site names
Returns indexed array holding site names available for SMS_Web_Sender to use.
Send SMS
This method should be called only after some sites have been added to the SMS_Web_Sender object.
Example:
1 // create instance of SMS_Web_Sender
2 $sws =& new SMS_Web_Sender();
3 // add a site, in this example 'asite' must be a valid site our
4 // SMS_Web_Sender object can locate, see documentation for more on this.
5 $sws->add_site('asite', 'username', 'pass');
6 // Send message
7 if ($sws->send('+44', '07977777777', 'Hello, this is my message')) {
8 echo 'Success, your message has been sent';
9 } else {
10 echo 'Sorry, send failed, reason: ', $sws->get_error();
11 }
country code
number to send (including leading '0' but excluding country code)
message
Set allow SMSSend
If enabled add_site() and get_site_names() will also look in the smssend_sites folder to find sites.
pass true to enable, false to disable
Set HTTP client
User_Agent object
Site class exists
Documention generated on Sat, 19 Jul 2003 03:43:29 +0100 by phpDocumentor 1.2.0