NAME

Net::SMS::TxtLocal - Send SMS messages using txtlocal.co.uk

SYNOPSIS

my $txtlocal = Net::SMS::TxtLocal->new(
    uname => 'you@domain.com',
    pword => 'secret',
    from  => 'Your Name',        # optional
);

# get the current balance
my $balance = $txtlocal->get_credit_balance();

# send a message
$txtlocal->send_message(
    {
        message => "This is a test message from Net::SMS::TxtLocal",
        to      => [ '447890123456' ],
    }
);

DESCRIPTION

This module is a super simple interface to the TxtLocal API which lets you send SMS messages from your code.

ABOUT TXTLOCAL

TxtLocal is a UK based SMS service which lets you send messages to mobiles worldwide. Their website is clean, their pricing reasonable and their API pretty good too.

If you need to create an account and use this link some pennies might flow back into the author's pockets: http://www.txtlocal.co.uk/?tlrx=52009

If this shameless commercialism offends you use this link instead: http://www.txtlocal.co.uk/.

METHODS

new

$txtlocal = Net::SMS::TxtLocal->new(
    uname => 'you@domain.com',
    pword => 'secret',
    from  => 'Your Name',  # optional
);

Create a sender object. uname and pword are required and should be your login to the TxtLocal system.

from is optional and is added to any messages sent.

get_credit_balance

my $credit_balance = $txtlocal->get_credit_balance();

Get the credit balance for this account from TxtLocal. This will try to connect to their servers and is a good way to test that the connection is available.

send_message

$bool = $txtlocal->send_message(
    {
        message => 'the text of the message',
        to      => ['447890123456'],
    }
);

Send a message to the numbers given in the array.

PRIVATE METHODS

_make_request

my $response = $txtlocal->_make_request(
    {
        path  => '/path/to/page.php',
        query => { foo => 'bar' },
    }
);

Make a POST request to the TxtLocal servers. The uname and pword will be added to the request and content returned - either as a string or a datastructure.

BUGS

No bugs have been reported.

Please report any bugs or feature requests to bug-net-sms-txtlocal@rt.cpan.org, or through the web interface at http://rt.cpan.org.

CONTRIBUTING

The repository for this module is hosted here: http://github.com/evdb/Net-SMS-TxtLocal

Please feel free to fork, make changes and send me a patch :)

AUTHOR

Edmund von der Burg <evdb@cpan.org>

LICENCE AND COPYRIGHT

Copyright (c) 2010, Edmund von der Burg <evdb@cpan.org>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.