Net::SMS::Mollie - Send SMS messages via the mollie.nl service
use strict; use Net::SMS::Mollie; my $mollie = new Net::SMS::Mollie; $mollie->login('username', 'p4ssw0rd'); $mollie->recipient('0612345678'); $mollie->send("I can send SMS!"); if($mollie->is_success) { print "Successfully sent message to ".$mollie->successcount." number(s)!"; } else { print "Something went horribly wrong!\n". "Error: ".$mollie->resultmessage." (".$mollie->resultcode.")"; }
or, if you like one liners:
perl -MNet::SMS::Mollie -e 'send_sms("username", "password", "recipient", "text", "originator")'
Net::SMS::Mollie allows sending SMS messages via http://www.mollie.nl/
Net::SMS::Mollie
new creates a new Net::SMS::Mollie object.
new
Defaults to https://secure.mollie.nl/xml/sms/, but could be set to, for example, the non SSL URL http://www.mollie.nl/xml/sms/.
Configure your own LWP::UserAgent object, or use our default one.
Defaults to gateway "1". For more information on the mollie.nl gateways, please read http://www.mollie.nl/docs/help/?id=1
The sender of the SMS. Could be 14 digits or 11 characters. Defaults to "Mollie", so you most likely do want to override this default.
Your mollie.nl username
Your mollie.nl password
Takes an array of phonenumbers to send the message to.
The actual SMS text
Defaults to normaal, but could be set to normaal, wappush, vcard, flash, binary, or long
optional When do you want to send the SMS? Format: yyyymmddhhmmss
optional
optional Only useful for the wappush type. Specify the URL of the wappush content.
optional Only useful for the binary type. Specify the header of the SMS message.
All these options can be set at creation time, or be set later, like this:
$mollie->username('my_username'); $mollie->password('my_password'); $mollie->type('wappush'); $mollie->url('some_url');
Without an argument, the method will return its current value:
my $username = $mollie->username; my $baseurl = $mollie->baseurl;
Set the username and password in one go.
$mollie->login('my_username', 'my_p4ssw0rd'); # is basically a shortcut for $mollie->username('my_username'); $mollie->password('my_p4ssw0rd');
Without arguments, it will return the array containing username, and password.
my ($user, $pass) = $mollie->login;
Push numbers in the recipients array
foreach(qw/1234567890 0987654321 1292054283/) { $mollie->recipient($_); }
Send the actual message. If this method is called with an argument, it's considered the message. Returns true if the sending was successful, and false when the sending failed (see resultcode and resultmessage).
Returns true when the last sending was successful and false when it failed.
Returns the amount of messages actually sent (could be useful with multiple recipients).
Returns the resulting code, as provided by mollie.nl. See http://www.mollie.nl/geavanceerd/sms/http/ for all possible codes.
When LWP::UserAgent reports an error, the resultcode will be set to -1.
-1
Returns the result message, as provided by mollie.nl, or LWP::UserAgent.
Requires both username and password to be set, and returns the amount of remaining credits (with 4 decimals) or undef:
if(my $credits = $mollie->credits) { print $credits." credits left!\n"; } else { print $mollie->resultmessage." (". $mollie->resultcode.")\n"; }
http://www.mollie.nl/geavanceerd/sms/http/
http://www.mollie.nl/docs/help/?id=1
Please report any bugs to http://rt.cpan.org/Ticket/Create.html?Queue=Net-SMS-Mollie
M. Blom, <blom@cpan.org>, http://menno.b10m.net/perl/
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
To install Net::SMS::Mollie, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::SMS::Mollie
CPAN shell
perl -MCPAN -e shell install Net::SMS::Mollie
For more information on module installation, please visit the detailed CPAN module installation guide.