Net::SMS::Clickatell - Access to Clickatell SMS messaging service
use Net::SMS::Clickatell;
my $catell = Net::SMS::Clickatell->new( API_ID => $api_id );
$catell->auth( USER => $user, PASSWD => $passwd );
$catell->sendmsg( TO => $mobile_phone, MSG => 'Hi, I\'m using Clickatell.pm' );
Clickatell (http://www.clickatell.com) is a commercial service that allows its
users to send SMS messages to anyone in the world. This service supports many
ways to send messages, for example HTTP, SMTP and SMPP, among others.
Net::SMS::Clickatell provides OO methods that allow to send SMS
messages through Clickatell service.
Note that whether this software nor the author are related to
Clickatell in any way.
- new
- Creates the Clickatell object.
Usage:
my $catell = Net::SMS::Clickatell->new( API_ID => $api_id );
The complete list of arguments is:
API_ID : Unique number received from Clickatell when an account is created.
UseSSL : Tell Clickatell module whether to use SSL or not (0 or 1).
BaseURL : Default URL used to connect with Clickatell service.
UserAgent : Name of the user agent you want to display to Clickatell service.
- auth
- Logs in Clickatell service,
Usage:
$catell->auth( USER => $user, PASSWD => $passwd );
where $user and
$password are your credentials for Clickatell
service.
This method returns 1 or 0 if we logged in or not .
- sendmsg
- Sends a message trought Clickatell service.
Usage:
$catell->sendmsg( TO => $mobile_phone, MSG => $msg );
where $mobile_phone is the mobile
phone number that you wants to sends the message (international format,
no leading zeros) and $msg is the message's
text.
This method return 1 or 0 if we successfully sent the message
or not.
- session_id
- Set or retrieve a session identificator number. This number is returned by
Clickatell service when a user logs in successfully in the service.
Usage:
$catell->session_id(); # Retrieve session identificator number
or
$catell->session_id($sid); # Set session identificator number to $sid
- msg_id
- Set or retrieve a message identificator number. This number is returned by
Clickatell service is a message was successfully sent.
Usage:
$catell->msg_id(); # Retrieve message identificator number
or
$catell->msg_id($mid); # Set message identificator number to $mid
- error
- Returns a code that describes the last error ocurred.
Example:
if(my $error = $catell->error) {
if($error == 1) {
die("Username or password not defined\n");
} elseif ($error == 2) {
die("Username or password invalid\n");
} else {
die("Unexpected fault\n");
}
}
Complete list of error codes:
0 - No error
1 - Username or password not defined
2 - Username or password wrong
3 - Server has problems
4 - The message couldn't be sent
Roberto Alamos Moreno <ralamosm@cpan.org>
Copyright (c) 2004 Roberto Alamos Moreno. All rights reserved. This program is
free software; you can redistribute it and/or modify it under the same terms
as Perl itself.
Clickatell is Copyright (c) 2004 Clickatell (Pty) Ltd: Bulk SMS
Gateway
This software or the author aren't related to Clickatell in any
way.
Hey! The above document had some coding errors, which are explained
below:
- Around line 389:
- =back doesn't take any parameters, but you said =back 4