WWW::SMS(3)
π NAME π
Welcome to WWW::SMS(3) β yes, the User Contributed Perl Documentation one β bestie. This is the manual for WWW::SMS: sends SMS using service provided by free websites. No cap, that's the whole name vibe. β¨
β¨ SYNOPSIS β¨
Okay so here's the starter pack, fr fr:
use WWW::SMS;
my $sms = WWW::SMS->new(
'39', #international prefix
'333', #operator prefix
'1234567', #phone number
'This is a test.', #message text
username => 'abcde', #optional parameters
passwd => 'edcba' #in hash fashion
);
#or now even just
my $sms = WWW::SMS->new($whole_number, $smstext);
for ( $sms->gateways(sorted => 'reliability') ) {
#for every compatible gateway
if ($sms->send( $_ ) { #try to send sms
last; #until it succeds
} else {
print $WWW::SMS:Error; #here is the error
}
}
π¦ DESCRIPTION π¦
WWW::SMS a Perl framework for sending free SMSs over the web. Iconic, honestly.
A new WWW::SMS object must be created with the new method. Once created you can send it through one of the available submodules. Main character energy only π
WWW::SMS->new(INTPREFIX, OPPREFIX, PHONE_NUMBER, MESSAGETEXT [, OPTIONS]);
WWW::SMS->new(WHOLE_NUMBER, MESSAGETEXT [, OPTIONS]);
This is the default SMS object constructor.
INTPREFIXβ the international prefix: some gateways just don't use the international prefix, but put something in here anyway. π«ΆOPPREFIXβ the operator prefix.PHONE_NUMBERβ not much to say.WHOLE_NUMBERβ the alternative constructor uses the the whole number of your cellphone: it includes international prefix and operator prefix. It relies on the database inTelephone::Numberto split your number in its 3 basic parts. So if unsure just use the"three-part-phone-number"constructor.MESSAGETEXTβ even here not much to say. Submodules are going to cut the SMS to the maximum allowed length by the operator. You can check anyway the maximum length directly looking for theMAXLENGTHconstant in submodules.OPTIONSβ are passed in a hash fashion. The useful ones to set include:proxyβ your HTTP proxy.cookie_jarβ the file where to store cookies. If not set, every cookie goes in the filelwpcookies.txtin your working directory.usernameandpasswdβ used by registration based gateways.- Other parameters may be required by specific submodules.
π METHODS π
$sms->send("GATEWAY")β sends$smsusingGATEWAY: returns1if succesfull,0if there are errors. The last error is in the$WWW::SMS::Errorvariable.GATEWAYβ the gateway you wish to use for sending the SMS: must be a scalar.
gateways([OPTIONS])β scans@INCdirectories and returns anARRAYcontaining the names of the available gateway submodules. If used upon a SMS object the submodules list returned is filtered by the PREFIX capability. Like this:
WWW::SMS->gateways(); #returns every available gateway
$sms->gateways(); #returns just the gateways that can send $sms
#compatible gateways sorted by reliability
$sms->gateways(sorted => 'reliability');
π SUBMODULE GUIDELINES π
So, now you got WWW::SMS but what's next? Well, all that's cool about it resides in submodules. A submodule got to do the dirty work of GETting and POSTing webpages. How to write a submodule then? There are a few points to observe:
- Take a look at submodules provided as example first! Yes, copying and pasting a submodule structure is a good start point.
sub MAXLENGTHβ please set theEXPORTableconstantMAXLENGTHto what is the maximum length of SMS the gateway you are scripting for allow.@PREFIXESβ@PREFIXESgot to be an array ofTelephone::Numberobjects.Telephone::Number->new takes 3 parameters: each one can be a scalar or an array reference. Each scalar or element of referenced arrays is a regular expression. Code will check for the phone number to match at least one of the regexp for each of intpref, prefix and phone_number. If you don't have regexp for one of these fields just give undef toTelephone::Number->new. Take a look at other submodules to better make up your mind.- Steps and
$WWW::SMS::Errorβ do GETs and POSTs as you want, using other submodules as you like. Just remember to mark each GET or POST with a increasing step number. And when you got an error please set the error variable$WWW::SMS::Errorto something useful and include the step number in it, so debugging will be easier. Then return0. If everything goes alright just return1. - Post your module back to the community! That's important, cause having a high available number of working gateways is difficult (websites keep changing pretty fast) so everybody should share his/her new & cool submodules implementation. Thank you. π«Ά
π COPYRIGHT π
Copyright 2001-2003 Giulio Motta giulienk@cpan.org Ivo Marino eim@cpan.org.
Project page at http://www-sms.sourceforge.net/
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Bye bestie π this page came from perl v5.42.0, dated 2025-12-14. Slay and read the docs β¨
π¦ where this page comes from
- arch rolling: perl-www-sms 0.09-19 Β· GPL AND PerlArtistic
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms