The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::SMS::TWSMS - Send SMS messages via the www.twsms.com service.

SYNOPSIS

  use strict;
  use Net::SMS::TWSMS;

  my $sms = new Net::SMS::TWSMS;
     $sms->login('username', 'p4ssw0rd');
     $sms->smsRecipient('0912345678');
     $sms->smsSend("The SMS be send by TWSMS Service!");

  if($sms->is_success) {
     print "Successfully sent message to ".$sms->successcount." number!\n";
  } else {
     print "Something went horribly wrong!\n".
           "Error: ".$sms->resultmessage." (".$sms->resultcode.")".
  }

or, if you like one liners:

  perl -MNet::SMS::TWSMS -e 'send_sms("twsms_username", "twsms_password", "recipient", "messages text")'

DESCRIPTION

Net::SMS::TWSMS allows sending SMS messages via http://www.twsms.com/

METHODS

new

new creates a new Net::SMS::TWSMS object.

Options

baseurl

Defaults to http://api.twsms.com/send.php, but could be set to, for example, the SSL URL https://api.twsms.com/send.php.

ua

Configure your own LWP::UserAgent object, or use our default one.

username

Your twsms.com username

password

Your twsms.com password

smsMessage

The actual SMS text

smsType

Defaults to now, but could be set to dlv

now mean send SMS now. dlv mean send SMS at a delivery date.

smsPopup

Defaults to undef, but could be set to 1

if smsPopup = 1

mean the SMS context will show on the screen of Receiver's mobile phone,

but will not save into Receiver's mobile phone.

smsMo

Defaults to undef, but could be set to y

smsEncoding

Defaults to big5, but could be set to ascii, unicode, push, or unpush

big5: the SMS context in Chinese or Engilsh, the max of SMS context length is 70 character. ascii: the SMS context in Engilsh, the max of SMS context length is 160 character. unicode: the SMS context in Unicode. push: the max length of SMS context + WapUrl is 88 Bytes A half witdh of alphanumeric is 1 byte A full withd of alphanumeric or a Chinese word is 3 Bytes unpush: as push

smsValidtime

Defaults to 86400

SmsVldtime mean the available time of SMS.

Its unit in sec. Example: 86400 (mean 24 hours)

smsDeliverydate

SmsDlvtime mean send SMS at a reserved time.

Its format is YYYYMMDDHHII.

Example: 200607291730 (mean 2006/07/29 17:30)

All these options can be set at creation time, or be set later, like this:

  $sms->username('my_username');
  $sms->password('my_password');
  $sms->smsType('push');
  $sms->smsWapUrl('http://wap_url');

login

Set the username and password in one go.

  $mollie->login('my_twsms_username', 'my_twsms_password');

  # is basically a shortcut for

  $sms->username('my_twsms_username');
  $sms->password('my_twsms_password');

Without arguments, it will return the array containing username, and password.

   my ($username, $password) = $sms->login();

smsRecipient

Push a phone number in the mobile variable

     $sms->recipient('0912345678');

smsSend

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).

is_success

Returns true when the last sending was successful and false when it failed.

resultcode

Returns the resulting code, as provided by twsms.com. See the API document http://www.twsms.com/dl/api_doc.zip for all possible codes.

When LWP::UserAgent reports an error, the resultcode will be set to -999.

resultmessage

Returns the result message, as provided by twsms.com, or LWP::UserAgent.

EXPORT

send_sms

SEE ALSO

The API document of TWSMS

http://www.twsms.com/dl/api_doc.zip

WEBSITE

You can find information about TWSMS at :

   http://www.twsms.com/

AUTHOR

Tsung-Han Yeh, <snowfly@yuntech.edu.tw>

COPYRIGHT AND LICENSE

Copyright (C) 2006 by Tsung-Han Yeh

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.