New project page available at Sourceforge. Please take a look for latest code.

I have just started developing a new library about sending free SMS via websites. I think it will look similar in structure to WWW::Search with many WWW::SMS::SomeGateway submodules. I read perlmod and perlmodlib but before finalizing the simple methods and writing documentation i'd like to have some advice from some higher level monks. Anybody is willing to help me out? I will send him the first scratch of my work licensed under GPL. Here is some code from SMS.pm:

#!/usr/bin/perl -w #Copyright (c) 2001 Giulio Motta. All rights reserved. #This program is free software; you can redistribute it and/or #modify it under the same terms as Perl itself. package WWW::SMS; use Carp (); $VERSION = '0.01'; sub new { my $class = shift; my $self; if (@_ == 4) { my ($intpref, $prefix, $telnum, $smstext) = @_; $self = bless { 'intpref' => $intpref, 'prefix' => $prefix, 'telnum' => $telnum, 'smstext' => $smstext }, $class; } else { $self = bless{}, $class; } } sub send_sms { my ($class, $sms, $gateway) = @_; my $gate = "${class}::${gateway}"; eval "use $gate qw(" . '%PREFIXES _send)'; Carp::croak("not such a gateway available: $gateway ($@)\n") i +f ($@); if (%PREFIXES) { ((warn "Prefix $sms->{prefix} not supported by $gatewa +y") && ret +urn 0) unless (exists $PREFIXES{$sms->{prefix}}); } return _send($sms); }
And here is the sample for a submodule:
#!/usr/bin/perl -w package WWW::SMS::Vizzavi; require Exporter; @ISA = qw(Exporter); @EXPORT = qw(); @EXPORT_OK = qw(%PREFIXES _send MAXLENGTH); %PREFIXES = map {$_, 1} qw(333 335 338 339 340 347 348 349 328 329 380 + 388 389); $VERSION = '1.00'; sub MAXLENGTH () {140} sub _send { my $self = shift; use HTTP::Request::Common qw(GET POST); use HTTP::Cookies; use LWP::UserAgent; $ua = LWP::UserAgent->new; $ua->agent('Mozilla/5.0'); $ua->cookie_jar(HTTP::Cookies->new( file => "lwpcookies.txt", autosave => 1)); $self->{smstext} = substr($self->{smstext}, 0, MAXLENGTH - 1) if (length($self->{smstext})>MAXLENGTH); $req = POST 'http://sms.vizzavi.it/global.asp', [ 'txtMsg' => $self->{smstext} ,'selPref' => $se +lf->{prefix}, 'TypeOpen' => '1' ,'txtTel' => $self->{telnum} + , 'Counter' => '' ]; $req->headers->referer('http://sms.vizzavi.it/freesms_conf.asp +'); print "1...\n"; $file = $ua->simple_request($req)->as_string; return 0 unless ($file =~ m'Messaggio\+accodato\+con\+successo +'s); $ua->cookie_jar->clear(); 1; } 1;
Sorry for the poor indentation :`(

Replies are listed 'Best First'.
Re: WWW::SMS
by rrwo (Friar) on Oct 18, 2001 at 02:35 UTC

    Take a look at the following modules:

    There maybe more out there.

    Note that many pagers and cell phones have E-mail gateways, so it's just as easy to send E-mail usng one of the zillions of E-mail modules out there.

    Also note different companies have different limits on the sizes of their <acronym title="Short Message System">SMS</acronym> messages (110 characters, 120 characters, 240 characters, etc.)

      I'm not trying to write a Net::Something module about a new protocol. Instead i want to give a high level and simple interface to sending SMS through the free web services available online.

      I don't know what's the situation with SMS in the US, but here in Europe no much people have e-mail gateway. Anyway my base WWW::SMS accept any kind of submodule that conforms to the standards i'm going to set, so there will be no problem i think in writing one that make use of an e-mail gateway.

      About different sizes of SMS, well, the MAXLENGTH exportable constant of submodules is just for that :)

      Anyway i started a project on sourceforge: sources are already there so you can take a look at latest evolutions.

        You could try connecting directly to the E-mail server for the particular service. (Most services document this.)

        If somebody can connect to the Internet, they can directly connect to a service's E-mail server to send mail to a user on that server, and likely they can use SNPP directly, unless there are firewall issues.

        Anyway, you should look at those modules I referred to. If nothing else, web gateways to SMS are not standardized like search engine interfaces, so your code may break every time the service provider decides to redesign their pages.

Re: WWW::SMS
by zuqif (Hermit) on Oct 17, 2001 at 17:23 UTC
    Am happy to help out, as have worked various cgi based sms solutions before ..
    sadly, my experience was that as quickly as I customised my code for any given free-sms-provider,
    they changed the forms / security model, and I had to start all over again.
    I suspect you'll bang against the same problem when trying to create a generic module.

    Other sites include : http://www.mtnsms.co.za
    the 'qif;
      Yeah, that's true. Sites keeps changing fast. But the first attempt is to write a library WWW::SMS to which everybody can conform. Using the same standard we can share libraries to have always at least a working gateway. If you take a look at the WWW::SMS::Vizzavi sample submodule, i think it's not too hard to get a working submodule ready. That's a really simple one but you can write submodules as complicated as you want and the more they get complicated the less the site owner is gonna change often.
Re: WWW::SMS
by seanbo (Chaplain) on Oct 16, 2001 at 22:05 UTC
    Why don't you post the code, there may be more people willing to make a comment or two on a few lines rather then sign up to help the whole project. Every bit of help counts. Other than that, I would be happy to help.

    seanbo
Re: WWW::SMS
by BMaximus (Chaplain) on Oct 18, 2001 at 04:34 UTC
    I need to learn more about SMS before I can really be of any use at all. Not sure as to what goes behind the scenes or understand the protocol. Any suggestions as to where I can bone up on some info on this? I'll definatly rumage through the Net::SMS code for starters.

    BMaximus