wget or script or MSDOS batch or utility to send SMS message to a telco website http://sms.singtel.com/internetsms/

sunhux
sunhux used Ask the Experts™
on
Hi

I need to send SMS via scripts (MSDOS batch file) to my telco's website.

So if I want to send SMS manually, currently I would do the following :
a) http://sms.singtel.com/internetsms/   (use IE to browse this link / site)
b) key in my  Email (ie my login id which is  xxx@pacific.net.sg) &
    then key in my password  yyyyyyyy  (& hit ENTER)
c) then in the next page I'm presented, I key the telephone number
    (say 12345678) that  I wish to SMS / message to and click OK
d) then I enter the message in the "Message window" (subject to
    150 chars max and then click  "Send Message" button
e)then I click "Close Window"

Is there any tool (something like wget) that would emulate those
keystroke and clicking and text that I typed in so that I could automate
all these in an MSDOS batch / script?

Appreciate detailed/specific codes and instructions.

Pls avoid suggesting me to buy tools or subscribe to a chargeable service
as my above current service is provided to me free of charge by my telco
Singtel
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
Hi again

I found the following Perl script which I'm not sure how to amend / modify to be able to
support my telco provider's site;  in case anyone care to modify it to support my telco's
website, would be great :

The website/link I got the script from is :
http://caspian.dotconf.net/menu/Software/SendSMS/

(appears that the script below is for Unix & not for Windows?

#!/usr/bin/perl
##########################################################################
$prognfo = <<EOM;

sendSMS.pl  v0.2.4     03/08/2006
copyright (c) 2001-2006 by Paul Kreiner

EOM
#
# Written by: Paul Kreiner <deacon@thedeacon.org>
#   with portions by: Brandon Zehm <caspian@dotconf.net>
#
# History:
# The original sendSMS.pl was an personal-use hack written
#   by Brandon Zehm.  It has been completely rewritten to
#   be modular, robust, and extendable, and to easily allow the
#   addition of other service providers.
#
# Changelog:
# v0.2.4     03/08/2006
#   Incorporated patch to add Alltell Wireless support (provided by Anthony
#   Valley).  Marked Cricket support as deprecated, since Cricket is
#   specifically blocking scripts such as this one through technical measures.
#   CRICKET support will be removed in a future release.
#   Paul Kreiner
#
# v0.2.3     12/15/2005
#   Incorporated patch to add Cingular support (provided by Barret Kendrick).
#   Paul Kreiner
#
# v0.2.2     10/04/2004
#   Incorporated change to ATTWS profile to reflect changes on their website.
#   (reported and patch provided by Joel Chen)
#   Paul Kreiner
#
# v0.2.1     09/25/2004
#   Added support for HTTPCookie parameter for each provider. Currently, only
#   SPRINT requires a cookie to be set, but others may need it later.
#   Incorporated changes and features to support Sprint PCS now that they've
#   changed their website again (thanks to Joel Chen for his help).
#   Paul Kreiner
#
# v0.2.0     05/13/2004
#   Incorporated patch to add Bell Canada / Bell Mobility support (provided
#   by David Caplan).
#   Removed support for deprecated 'VSTREAM' service provider. NOTE: If you
#   are still using 'VSTREAM', you must switch to 'TMOBILE'.
#   Paul Kreiner
#
# v0.1.9     12/12/2003
#   Incorporated change to Sprint PCS profile to reflect changes on their
#   website - they only send 'Message sent' now (reported by Ken Cochran).
#   Added global version/date/copyright variables to code so help screen
#   gives program info without having to modify it in multiple places.
#   Simplified the help screen by removing "written by:" and extra CR's.
#   Paul Kreiner
#
# v0.1.8     09/15/2003
#   Incorporated patch to add Sprint PCS support (provided by John Carbone).
#   Paul Kreiner
#
# v0.1.7     09/04/2003
#   Incorporated patch to add T-Mobile support (provided by Manuel Martin).
#   Incorporated patch to add Cricket support (provided by Tod Morrison).
#   Marked VoiceStream support as deprecated in help and code comments.
#   Small fixes for typos and minor cosmetic code cleanups.
#   Paul Kreiner
#
# v0.1.6     08/12/2002
#   Updated ATTWS profile to reflect changes on their website.
#   Jared Cheney
#
# v0.1.5     05/29/2002
#   Updated to support web proxies.
#   Brandon Zehm
#
# v0.1.4     04/04/2002
#   Updated VoiceStream Support and added support for SkyTel pagers.
#   Brandon Zehm
#
# v0.1.3     01/22/2001
#   Some changes to get this running on Win32 (ActiveState 5.6.0/build 623).
#   Couldn't get POSIX::termios or IO::Select to correctly make STDIN non-
#   blocking, so I gave up after ~4 hrs of trying, and simply removed the
#   STDIN message-sending functionality for Win32.  If someone out there
#   can send me a patch (and NOT simply include an external module, such as
#   Term::ReadKey or something) then maybe it'll be supported.
#   Paul Kreiner
#
# v0.1.2     01/20/2001
#   Added support for passing a message via STDIN.  Got the list of providers
#   in the help sub to be dynamically generated, making it that much easier to
#   add service providers (only two places to edit, now.)  Implemented signal
#   trapping for cleaner exits.  Added support for Cellular One (unverified).
#   Minor code cleanups.
#   Paul Kreiner
#
# v0.1.1     01/17/2001
#   Update to improve modularity and make adding new providers much easier
#   than before.   Finished removing any global vars, just because I can.
#   Replaced original encodeAsURL code with much more efficient algorithm.  I
#   think that was the last of Brandon's original code.
#   Paul Kreiner
#
# v0.1.0     01/15/2001
#   Initial 'beta' release.  Basic functionality in place, although modularity
#   needs to be improved.  This is a full rewrite of the original sendSMS.pl
#   script, with commentary, support for multiple providers, and a more robust
#   user interface.  Includes support for AT&T WS and VoiceStream (verified).
#   Paul Kreiner
#
# Notes:
# It's a big script, for what it does.  Note that one of the primary
#   design goals was to have a single self-contained script that
#   would do everything -- no CPAN modules, .conf files, etc.
#   The layout of the script is set up so the templates for various
#   service providers appear right near the top, so if someone
#   (yeah, this means YOU) wants to add/modify support for
#   a service provider, it should be really easy to see all the fields
#   to modify.
#
# License:
# sendSMS.pl (hereafter referred to as "program") is free software;
#   you can redistribute it and/or modify it under the terms of the GNU General
#   Public License as published by the Free Software Foundation; either version
#   2 of the License, or (at your option) any later version.
# Note that when redistributing modified versions of this source code, you
#   must ensure that this disclaimer and the above coder's names are included
#   VERBATIM in the modified code.
#
# Disclaimer:
# This program is provided with no warranty of any kind, either expressed or
#   implied.  It is the responsibility of the user (you) to fully research and
#   comprehend the usage of this program.  As with any tool, it can be misused,
#   either intentionally (you're a vandal) or unintentionally (you're a moron).
#   THE AUTHOR(S) IS(ARE) NOT RESPONSIBLE FOR ANYTHING YOU DO WITH THIS PROGRAM
#   or anything that happens because of your use (or misuse) of this program,
#   including but not limited to anything you, your lawyers, or anyone else
#   can dream up.  And now, a relevant quote directly from the GPL:
#
#                           NO WARRANTY
#
#  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
# FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
# OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
# PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU.  SHOULD THE
# PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
# REPAIR OR CORRECTION.
#
#   ---
#
# Whee, that was fun, wasn't it?  Now let's all get together and think happy
#   thoughts.  And remember, the same class of people who made all the above
#   legal spaghetti necessary are the same ones who are stripping your rights
#   away with DVD CCA, DMCA, stupid software patents, and retarded legal
#   challenges to everything we've come to hold dear about our internet.
#   So enjoy your dwindling "freedom" while you can, because 1984 is coming
#   sooner than you think.  :[
#######################################
# Some quick function definitions (in order of appearance):
#
# sub getProvider:    names & parameters of service providers. USER MODIFYABLE.
# sub initialize:     sets up initial SIG handlers & alarms
# sub run:            the main loop of the program
# sub processCmdLine: parse STDIN and command line for user input
# sub checkInput:     sanity check of user-input values
# sub encodeAsURL:    encodes any string(s) as legit URL(s)
# sub openSocket:     opens a socket to remote webserver
# sub sendData:       build & send HTTP request to remote server
# sub waitforReply:   waits for success/fail response from remote server
# sub printHelp:      print user help message & list of providers
# sub exit:           exit, print optional error message and close filehandles
######################################

# Here we go...
use vars qw($prognfo);
use strict;
initialize();     ### set up some initial SIG handlers, etc.
run();            ### executes the main body of the program (done for readability)
exit(1);          ### execution should never get here, but just in case...


############
# Function: getProvider( \$HTTPRequestMethod,
#   \$HTTPRequestString, \$HTTPReferer, \$HTTPCookie, \$remoteHostName,
#   \$formDataString, \$successString, \$provider, \$receiver,
#   \$sender, \$message )
# Pass this function several references to scalars, as follows:
#   -  $HTTPRequestMethod is either "GET" or "POST", depending
#   upon what is specified in the selected provider's template.
#   -  $HTTPRequestString is the rest of the GET or POST line that
#   is to be sent to the remote server.  Again, part of the template.
#   -  $HTTPReferer is the referer string defined in the provider's template.
#   -  $HTTPCookie is the cookie string defined in the provider's template.
#   Note that the cookie string can (and should) be left empty, unless you
#   *know* that your provider requires a cookie to work.
#   -  $remoteHostName is the name of the remote webserver.  It can also have
#   a "magic" value when the function is called, which will alter the behavior
#   of this function.  See below for more info.
#   -  $formDataString is the actual data, formatted differently per provider,
#   that will be submitted to the provider's website.  This string is defined
#   as part of each provider's template.
#   -  $successString is the string which we will wait to receive back
#   from the remote server, to signal that we were successful.  This is
#   defined differently for each provider, as part of their template.
#   -  $provider is the name of our selected service provider.
#   -  $receiver is the cellular number (10-digit) of our recipient.
#   -  $sender is the sender's name / number.
#   -  $messageBody is the text of the message body.
#
# This function will find the user-selected service provider's template
#   and fill in all other referenced variables with the correct info for that
#   provider.  This includes remote servername, HTTP request method,
#   referring webpage, success string, and a properly-formatted form
#   submission data string.
# There is a second use to this function -- if it is called with a magic value
#   of 'get providerNames' in $remoteHostName, it will return an array with
#   the names/descriptions of all available service providers.
###
sub getProvider
{
  (
  my $HTTPRequestMethod,
  my $HTTPRequestString,
  my $HTTPReferer,
  my $HTTPCookie,
  my $remoteHostName,
  my $formDataString,
  my $successString,
  my $provider,
  my $receiver,
  my $sender,
  my $messageBody,
  ) = @_;


##############################################################################
#
# BEGIN USER-MODIFYABLE SECTION:
#
##############################################################################

# List of providers by name.  First entry is the name of the service parameters
#   array.  Second entry is the "common" name of the service provider.  This is
#   the name that the provider will be referenced as on the command line.
#   Finally, the third entry is the full name of the service provider.  This is
#   used when the list of providers is printed (usually by the help function).
# NOTE: you will need to add your provider's info here, and below (in the
#   "parameters" section) to add support for them to sendSMS.  A sample entry
#   has been created for you.
my @providerNames = (
#  \my %TEMPLATE, 'TEMPLATE', 'An example service provider',
  \my %ALLTEL, 'ALLTEL', 'Alltel Wireless',
  \my %ATTWS, 'ATTWS', 'AT&T Wireless',
  \my %BELLCA, 'BELLCA', 'Bell Canada',
  \my %CINGULAR, 'CINGULAR', 'Cingular',
  \my %CELLONE, 'CELLONE', 'Cellular One',
  \my %CRICKET, 'CRICKET', 'Cricket [deprecated]',
  \my %SKYTEL, 'SKYTEL', 'SkyTel',
  \my %SPRINT, 'SPRINT', 'Sprint PCS',
  \my %TMOBILE, 'TMOBILE', 'T-Mobile',
);

if ($remoteHostName == 'get providerNames')
{   #return a list of providers immediately if being called with a magic
    #  value for remoteHostName
  return(@providerNames);
}

# Service provider's PARAMETERS section.  Note that an example TEMPLATE
#   provider entry is already here.  I suggest using a sniffer tool such as
#   ngrep or tcpdump to sniff the conversation between your browser and the
#   target webpage, then examining it to extract the relevant information for
#   use in this section.  For example, if a session to www.example.com runs as
#   follows:
#    POST /cgi-bin/sms.cgi HTTP/1.1
#    Referer: http://www.example.com/index.html
#    Host: www.example.com
#    Cookie: JSESSIONID=boguscookie
#    Content-type: application/x-www-form-urlencoded
#    Content-length: 53
#    sender=123&receiver=456&text=This is a test message
#
#   And a successful message returns a page with the text "Mesage submitted
#    successfully", then the data you'd insert below would be:

### An example service provider's parameters:
#%TEMPLATE = (
#  'remoteHostName'    => 'www.example.com',
#  'HTTPRequestMethod' => 'POST',
#  'HTTPRequestString' => '/cgi-bin/sms.cgi',
#  'HTTPReferer'       => 'http://www.example.com/index.html',
#  'HTTPCookie'        => 'JSESSIONID=boguscookie',
#  'successString'     => 'successfully',
#  'formDataString'    => 'sender=$$sender&receiver=$$receiver&text=$$messageBody',
#);

### Alltel Wireless service parameters
%ALLTEL = (
  'remoteHostName'    => 'message.alltel.com',
  'HTTPRequestMethod' => 'POST',
  'HTTPRequestString' => '/customer_site/jsp/messaging.jsp',
  'HTTPReferer'       => 'http://message.alltel.com/customer_site/jsp/messaging.jsp',
  'HTTPCookie'        => 'JSESSIONID=boguscookie',
  'successString'     => 'Message Status',
  'formDataString'    => 'devicetype=1&min=$$receiver&trackResponses=No&callback=$$sender&type=1&text=$$messageBody&count=0',
);

### AT&T Wireless service parameters:
%ATTWS = (
  'remoteHostName'    => 'www.mymmode.com',
  'HTTPRequestMethod' => 'POST',
  'HTTPRequestString' => '/messagecenter/sendMessage.do',
  'HTTPReferer'       => 'http://www.mymmode.com/messagecenter/init',
  'HTTPCookie'        => '',
  'successString'     => 'submitted',
  'formDataString'    => 'recipient=$$receiver&sender=$$sender&subject=&message=$$messageBody',
);

### Bell Canada (Bell Mobility) service parameters:
%BELLCA = (
  'remoteHostName'    => 'www.txt.bellmobility.ca',
  'HTTPRequestMethod' => 'POST',
  'HTTPRequestString' => '/sms/sendMessage',
  'HTTPReferer'       => 'http://www.txt.bellmobility.ca/sms/sendMessage',
  'HTTPCookie'        => '',
  'successString'     => 'essage was sent to',
  'formDataString'    => 'TEMPLATE=/img/sms/general/outbox/messageConfirmation.html&EXCEPTION_TEMPLATE=/img/sms/general/imgHtmlException.html&TRANSPORT_TYPE=sms&MIN_NUMBER=$$receiver&SMTP_RETURNPATH=&MIN_RETURNPATH=&FROM=&CALLBACK_NUMBER=&STATUS_REQUEST=&MESSAGE_SUBJECT=$$sender&MESSAGE_BODY=$$messageBody&CHARCOUNT=150&x=100&y=15'
);

### Cellular One service parameters:
%CELLONE = (
  'remoteHostName'    => ' www.celloneusa.com',
  'HTTPRequestMethod' => 'POST',
  'HTTPRequestString' => '/cgi-bin/sendMsg.pl',
  'HTTPReferer'       => 'http://www.celloneusa.com/message.cfm',
  'HTTPCookie'        => '',
  'successString'     => 'will be sent',
  'formDataString'    => 'toPhone=$$receiver&fromPhone=$$sender&SendTime=0&FormName2=Short\%20Messaging\%20System&FileName2=Message.pl&Required2=toPhone\%2BfromPhone\%2BtxtMessage&txtMessage=$$messageBody'
);

### Cingular Wireless service parameters:
%CINGULAR = (
  'remoteHostName'    => 'www.cingularme.com',
  'HTTPRequestMethod' => 'POST',
  'HTTPRequestString' => '/do/public/send',
  'HTTPReferer'       => 'http://www.cingularme.com/do/public/send',
  'HTTPCookie'        => 'JSESSIONID=aB5fMc38zGGc',
  'successString'     => 'clear the fields below',
  'formDataString'    => 'min=$$receiver&from=$$sender&subject=&msg=$$messageBody'
);

### Cricket service parameters:
### As of 3/8/06, CRICKET support is DEPRECATED and will be removed in the
### future.  Cricket has specifically been blocking scripts such as this from
### accessing their site.
%CRICKET = (
  'remoteHostName'    => 'www.mycricket.com',
  'HTTPRequestMethod' => 'POST',
  'HTTPRequestString' => '/text/sendto_sms_system.asp?Step=2',
  'HTTPReferer'       => 'http://www.mycricket.com/text/sendto_sms_system.asp',
  'HTTPCookie'        => '',
  'successString'     => 'Message Sent',
  'formDataString'    => 'cricket_phone_number=$$receiver&msg=$$messageBody&from=$$sender'
);

### SkyTel service parameters:
%SKYTEL = (
  'remoteHostName'    => 'www.skytel.com',
  'HTTPRequestMethod' => 'POST',
  'HTTPRequestString' => '/servlet/SendMessage',
  'HTTPReferer'       => 'http://www.skytel.com:80/servlet/SendMessage',
  'HTTPCookie'        => '',
  'successString'     => 'Received Your Message',
you can text for free from gmail and google voice, but I'm pretty sure that they have taken away any programmable interface into those systems.
Why not recording the actions using AutoIT and then simply creating an interface to get the phone number/message and use on the AutoIT script?
http://www.autoitscript.com/autoit3/

Much simpler IMHO.

Cláudio Rodrigues
Citrix CTP

Author

Commented:
Hi Jared,

Can you provide the detailed steps to do free texting / SMS in gmail ?
(click which options etc)


Hi tsmvp,

Thanks, I'll have a look at AutoIt at the same time, glad that it's  a freeware?

Author

Commented:
Hi again Jared / anyone else

Is the free texting in gmail or google voice for sending internationally
to all telco / mobile service providers?  Is there a way to send an email
and that email get's converted to SMS text that gets to someone's mobile
phone,  say if I email to 188889999@xxx.com, the email content gets
sent as SMS text to the person holding the mobile number 1888899999
(where 1 is USA's country code)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial