.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "WWW::SMS 3" .TH WWW::SMS 3 2023-07-26 "perl v5.38.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME WWW::SMS \- sends SMS using service provided by free websites .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 9 \& use WWW::SMS; \& my $sms = WWW::SMS\->new( \& \*(Aq39\*(Aq, #international prefix \& \*(Aq333\*(Aq, #operator prefix \& \*(Aq1234567\*(Aq, #phone number \& \*(AqThis is a test.\*(Aq, #message text \& username => \*(Aqabcde\*(Aq, #optional parameters \& passwd => \*(Aqedcba\*(Aq #in hash fashion \& ); \& \& #or now even just \& my $sms = WWW::SMS\->new($whole_number, $smstext); \& \& for ( $sms\->gateways(sorted => \*(Aqreliability\*(Aq) ) { \& #for every compatible gateway \& if ($sms\->send( $_ ) { #try to send sms \& last; #until it succeds \& } else { \& print $WWW::SMS:Error; #here is the error \& } \& } .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" \&\fBWWW::SMS\fR a Perl framework for sending free SMSs over the web. .PP A new \fBWWW::SMS\fR object must be created with the \fInew\fR method. Once created you can send it through one of the available submodules. .IP "WWW::SMS\->new(INTPREFIX, OPPREFIX, PHONE_NUMBER, MESSAGETEXT [, OPTIONS]);" 4 .IX Item "WWW::SMS->new(INTPREFIX, OPPREFIX, PHONE_NUMBER, MESSAGETEXT [, OPTIONS]);" .PD 0 .IP "WWW::SMS\->new(WHOLE_NUMBER, MESSAGETEXT [, OPTIONS]);" 4 .IX Item "WWW::SMS->new(WHOLE_NUMBER, MESSAGETEXT [, OPTIONS]);" .PD This is the default SMS object constructor. .Sp \&\f(CW\*(C`INTPREFIX\*(C'\fR is the international prefix: some gateways just don't use the international prefix, but put something in here anyway. .Sp \&\f(CW\*(C`OPPREFIX\*(C'\fR is the operator prefix .Sp \&\f(CW\*(C`PHONE_NUMBER\*(C'\fR not much to say .Sp \&\f(CW\*(C`WHOLE_NUMBER\*(C'\fR the alternative constructor use the the whole number of your cellphone: it includes international prefix and operator prefix. It relies on the database in \fITelephone::Number\fR to split your number in its 3 basic parts. So if unsure just use the "three-part-phone-number" constructor. .Sp \&\f(CW\*(C`MESSAGETEXT\*(C'\fR 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 the \fIMAXLENGTH\fR constant in submodules. .Sp \&\f(CW\*(C`OPTIONS\*(C'\fR are passed in a hash fashion. The useful ones to set include .RS 4 .Sp .RS 4 \&\f(CW\*(C`proxy\*(C'\fR your HTTP proxy .Sp \&\f(CW\*(C`cookie_jar\*(C'\fR The file where to store cookies. If not set, every cookie goes in the file "lwpcookies.txt" in your working directory. .Sp \&\f(CW\*(C`username\*(C'\fR and \f(CW\*(C`passwd\*(C'\fR Used by registration based gateways .Sp Other parameters may be required by specific submodules. .RE .RE .RS 4 .RE .SH METHODS .IX Header "METHODS" .ie n .IP "$sms\->send(""GATEWAY"")" 4 .el .IP \f(CW$sms\fR\->send(\f(CWGATEWAY\fR) 4 .IX Item "$sms->send(GATEWAY)" Sends \f(CW$sms\fR using \f(CW\*(C`GATEWAY\*(C'\fR: returns \fI1\fR if succesfull, \fI0\fR if there are errors. The last error is in the \f(CW$WWW::SMS::Error\fR variable. .Sp \&\f(CW\*(C`GATEWAY\*(C'\fR the gateway you wish to use for sending the SMS: must be a scalar. .IP gateways([OPTIONS]) 4 .IX Item "gateways([OPTIONS])" Scans \f(CW@INC\fR directories and returns an ARRAY containing 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: .Sp .Vb 1 \& 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 => \*(Aqreliability\*(Aq); .Ve .SH "SUBMODULE GUIDELINES" .IX Header "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: .IP "1 Take a look at submodules provided as example first!" 4 .IX Item "1 Take a look at submodules provided as example first!" Yes, copying and pasting a submodule structure is a good start point. .IP "2 sub MAXLENGTH" 4 .IX Item "2 sub MAXLENGTH" Please set the EXPORTable constant \f(CW\*(C`MAXLENGTH\*(C'\fR to what is the maximum length of SMS the gateway you are scripting for allow. .ie n .IP "3 @PREFIXES" 4 .el .IP "3 \f(CW@PREFIXES\fR" 4 .IX Item "3 @PREFIXES" \&\f(CW@PREFIXES\fR got to be an array of \f(CW\*(C`Telephone::Number\*(C'\fR objects. \&\f(CW\*(C`Telephone::Number\*(C'\fR\->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 \fIundef\fR to \f(CW\*(C`Telephone::Number\*(C'\fR\->new. Take a look at other submodules to better make up your mind. .ie n .IP "4 Steps and $WWW::SMS::Error" 4 .el .IP "4 Steps and \f(CW$WWW::SMS::Error\fR" 4 .IX Item "4 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 \f(CW$WWW::SMS::Error\fR to something useful and include the step number in it, so debugging will be easier. Then \fIreturn 0\fR. If everything goes alright just \fIreturn 1\fR. .IP "5 Post your module back to the community!" 4 .IX Item "5 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. .SH COPYRIGHT .IX Header "COPYRIGHT" Copyright 2001\-2003 Giulio Motta \fIgiulienk@cpan.org\fR Ivo Marino \fIeim@cpan.org\fR. .PP Project page at http://www\-sms.sourceforge.net/ .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.