NAME
WWW::SMS::IE::iesms - A module to send SMS messages using .ie websites
SYNOPSIS
To use a subclass:
require WWW::SMS::IE::o2sms;
my $carrier = new WWW::SMS::IE::o2sms;
if ($carrier->login('o2_user', 'password'))
{
my $retval = $carrier->send('+353865551234', 'Hello World!');
if (!$retval)
{
print $carrier->error() . "\n";
}
}
To extend this class:
package WWW::SMS::IE::o2sms;
require WWW::SMS::IE::iesms;
@WWW::SMS::IE::o2sms::ISA = qw{WWW::SMS::IE::iesms};
DESCRIPTION
WWW::SMS::IE::iesms is a module to send SMS messages via the command line using the websites of Irish mobile operators. This is done by simulating a web browser's interaction with those websites. This module requires a valid web account with O2 Ireland, Vodafone Ireland or Meteor Ireland.
The WWW::SMS::IE::iesms class is abstract, i.e. it is only used as a base class for WWW::SMS::IE::o2sms, WWW::SMS::IE::vodasms, WWW::SMS::IE::meteorsms and WWW::SMS::IE::threesms and should never be instantiated as itself.
The following methods are available:
- $carrier = new WWW::SMS::IE::iesms
-
This is the object constructor. It should only be called internally by this library. External code should construct WWW::SMS::IE::o2sms, WWW::SMS::IE::vodasms, WWW::SMS::IE::meteorsms and WWW::SMS::IE::threesms (and WWW::SMS::IE::aftsms) objects.
- $carrier->login($username, $password)
-
Logs in to the mobile operator's website. If provided, use the username and password specified in
$username
and$password
, otherwise use the username and password provided with theusername()
andpassword()
methods.Returns true on success, false on failure. The last error message is returned by the
error()
method. - $carrier->send($number, $message)
-
Sends the SMS message in
$message
to the recipient in$number
.Returns true on success, false on failure. The last error message is returned by the
error()
method.This method will fail if there is no login window, the number is invalid, or if there is a problem sending via the operator.
After sending, the number of free messages remaining in your account is returned by
remaining_messages()
. - $carrier->validate_number($number)
-
Returns the telephone number in
$number
converted to the international format, e.g.+353865551234
.Also verifies that the mobile provider can send to this number.
Returns -1 if the number is invalid,
validate_number_error()
gets the error message. - $carrier->validate_number_error()
-
After a unsuccessful
validate_number()
, returns the error message. - $carrier->is_logged_in()
-
Returns success if
login()
has been called successfully in this or a previous instance and if the login window has not expired. - $carrier->delay($message)
-
Some carriers required a pause of X seconds before the message is sent. This is performed automatically by the
send()
method.This method will return how long that delay will be.
- $carrier->login_lifetime()
-
Set/retrieve the maximum length of time (seconds), between requests that a session is alive for.
- $carrier->max_length()
-
Return the supported maximum length of a single SMS message.
This method can be overwritten by subclasses extending this class.
- $carrier->min_length()
-
Return the supported minimum length of a single SMS message.
This method can be overwritten by subclasses extending this class.
- $carrier->remaining_messages()
-
After a
send()
, this method returns the number of free messages remaining in your account. - $carrier->write_message_file($message)
-
Write the string <$message> to the message file as returned by
message_file()
. - $carrier->write_history_file($message)
-
Append the string <$message> to the history file as returned by
history_file()
. - $carrier->username()
- $carrier->password()
-
These methods get and set the username and password parameters respectively used to log in to your provider's website.
- $carrier->full_name()
- $carrier->domain_name()
-
These methods get/set the descriptive name and domain name respectively of this mobile operator.
These methods should be overwritten by subclasses extending this class.
- $carrier->is_vodafone()
- $carrier->is_o2()
- $carrier->is_meteor()
- $carrier->is_three()
- $carrier->is_aft()
-
These methods are used to determine what subclass is extending this class.
- $carrier->user_agent()
-
Return the
LWP::UserAgent
object used internally. - $carrier->config_file()
- $carrier->config_dir()
-
Set/retrieve the location of the config dir/file.
- $carrier->action_state_file()
- $carrier->message_file()
- $carrier->history_file()
-
These methods get/set the location of the files used by this module to store session data between invocations and to log messages.
- $carrier->_is_valid_number($number)
-
Mobile operator-specific checks on the number during a
validate_number()
.This methods should be overwritten by subclasses extending this class.
- $carrier->error()
-
Returns the last error after a login() or send().
- $carrier->debug()
-
Set/retrieve the debug level for the module (0,1,2).
DISCLAIMER
The author accepts no responsibility nor liability for your use of this software. Please read the terms and conditions of the website of your mobile provider before using the program.
SEE ALSO
WWW::SMS::IE::o2sms, WWW::SMS::IE::vodasms, WWW::SMS::IE::meteorsms, WWW::SMS::IE::threesms, WWW::SMS::IE::aftsms
http://www.mackers.com/projects/o2sms/
AUTHOR
David McNamara (me.at.mackers.dot.com)
COPYRIGHT
Copyright 2000-2006 David McNamara
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.