Net-SMS-O2_DE
view release on metacpan or search on metacpan
lib/Net/SMS/O2_DE.pm view on Meta::CPAN
use Net::SMS::O2_DE;
my $sms = Net::SMS::O2_DE->new(
autotruncate => 1,
username => '01701234567',
password => 'SECRET',
sender => 'YourMother',
recipient => '+4917676543210',
message => 'a test message',
);
$sms->verbose( 1 );
$sms->login();
print "Quota: " , $sms->quota(). "\n";
$sms->message( 'a different message' );
print "sending message to mobile number ", $sms->recipient();
$sms->send_sms();
$sms->logout();
=head1 WARNING
If you don't have any free sms left, sending SMS may cost you money!!
So check, if your quota is high enough to send the desired sms.
Use the function C<sms_count> to determine how much sms will be sent
with the current settings.
Keep in mind that if you have sheduled sms, they arent yet included in the C<quota>.
Eg: If you send now, with quota=10 a scheduled sms which will be sent each hour for
the next 3 hours, quota will be decreased to 9 after the first sms is sent.
An hour later to 8, another hour later to 7. So the quota will not be immideately 7.
If you have scheduled a sms with C<schedule_start> and C<frequency> but no end date is set
there will be send an infinite amount of sms. This this is in most cases undesired.
So remind to set C<schedule_start> AND C<schedule_end>
Use C<sms_count> to check, if you send an infinite number of sms.
=head1 DESCRIPTION
A perl module to send SMS messages, using the O2 web2sms gateway. This
module will only work with mobile phone numbers that have been registered with
O2 (L<http://www.o2.de/>) and uses form submission to a URL that may be
subject to change. The O2 service is currently only available to german
phone users with internet pack.
There is a maximum length for SMS message (1800 for O2). If the sum
of message length exceed this, the behaviour of the
Net::SMS::O2_DE objects depends on the value of the 'autotruncate' argument to
the constructor. If this is a true value, then the subject / message will be
truncated to 1800 characters. If false, the object will throw an exception
(die). If you set notruncate to 1, then the module won't check the message
length, and you are on your own!
This implementation is based on the module L<Net::SMS::O2>.
The HTTP requests are sent using L<Net::SMS::WEB> which uses L<LWP::UserAgent> module. If you are using a
proxy, you may need to set the HTTP_PROXY environment variable for this to
work (see L<LWP::UserAgent>).
=head1 TODO
There is no check if you entered a valid tel number or frequency or other fields.
=cut
#------------------------------------------------------------------------------
#
# Package globals
#
#------------------------------------------------------------------------------
use vars qw(
@ISA
$URL_PRELOGIN
$URL_LOGIN
$URL_SMSCENTER
$URL_PRESEND
$URL_SEND
$URL_SCHEDULE
$URL_LOGOUT
%REQUIRED_KEYS
%LEGAL_KEYS
$MAX_CHARS
$SINGLE_CHARS
);
@ISA = qw( Net::SMS::Web );
$URL_PRELOGIN = 'https://login.o2online.de/loginRegistration/loginAction.do?_flowId=login&o2_type=asp&o2_label=login/comcenter-login&scheme=http&port=80&server=email.o2online.de&url=%2Fssomanager.osp%3FAPIID%3DAUTH-WEBSSO%26TargetApp%3D%2Fsmscenter_n...
$URL_LOGIN = 'https://login.o2online.de/loginRegistration/loginAction.do';
$URL_SMSCENTER = 'http://email.o2online.de:80/ssomanager.osp?APIID=AUTH-WEBSSO&TargetApp=/smscenter_new.osp?&o2_type=url&o2_label=web2sms-o2online';
$URL_PRESEND = 'https://email.o2online.de/smscenter_new.osp?Autocompletion=1&MsgContentID=-1';
$URL_SEND = 'https://email.o2online.de/smscenter_send.osp';
$URL_SCHEDULE = 'https://email.o2online.de/smscenter_schedule.osp';
$URL_LOGOUT = 'https://login.o2online.de/loginRegistration/loginAction.do?_flowId=logout';
%REQUIRED_KEYS = (
username => 1,
password => 1,
);
%LEGAL_KEYS = (
username => 1,
password => 1,
sender => 1,
anonymous => 1,
recipient => 1,
message => 1,
verbose => 1,
audit_trail => 1,
flash_sms => 1,
frequency => 1,
schedule_start => 1,
schedule_end => 1,
);
( run in 1.006 second using v1.01-cache-2.11-cpan-71847e10f99 )