smssend.scripting(1)

NOM
smssend - The sms sender (to GSM)

SYNOPSYS
How to make a script for smssend.

DESCRIPTION
The scripts for Smssend are easy to make, but you'll have to follow some steps. First, I suggest you use a tool like tcpdump or ethereal, to trace the output traffic of your box. So, use your usual navigator and connect to the site you wish to make a script for, and send a sms (do all this while tracing output). With this, you'll have the URL to call, and the parameters to use (even the POST parameters). You are now ready to write your script (see an example at the end of this man page) : The line starting with a # are comments. On the first line, give the site's name. On the second, give the version number of your script (#Version x.xx). This is really important, because smssend uses this line to detect new version of the script. On the third line, give your name and email address. On the following lines, give the error messages that can happen running the script, with their number. Then, give the arguments the script will be waiting for, then aliases, and finnaly the commands.

  ARGUMENTS
First, you must give a line with the number of arguments (NbParams x). An argument line starts with a % and must be like this : %Name [Type] : Help message Here are the different types

Hidden
    Tells this argument is a password and must be hidden.

Convert
    Tells that this argument must be converted (space are converted to +, and non alphanum are converted to ascii code).

Size=xx
    Gives the maximum size are this argument in characters (for message, there is often a max size).

  ALIAS
Aliases are very useful, and are used next for dynamic replacement (you'll soon understand). An alias line starts with a $ and must be like this : $Argument alias Argument being the name of an existing argument (case non sensitive) and alias the name to search when replacing <input> tags.

  COMMANDS
One command per line. SmsSend defines blocs of commands (or phases) which are GET or POST requests. Each bloc must ABSOLUTELY starts with one of the GetURL or PostURL command, and ends with a GO, and must contain only ONE of these command. Between this two lines, you can add all optional commands as you wish. You can also (and you'll have to anyway) substitution commands (see next chapter).

GetURL <url> and PostURL <url>
    One and only one of these command per bloc, followed by the url to fetch without parameters and without the '?' (parameters are what is after a '?' in an URL) !!

Params <parameters>
    Gives the parameters associated with the URL to fetch (what is after a '?' in an URL), but without the '?'.

Referer <referer>
    Gives the referer of this url (some pages check if the Referer is correctly set).

PostData <data>
    Gives data from a form to send (must be used with PostURL).

Sleep <delay>
    Tells the soft to make a sleep of delay secondes before sending this request.

NoAdd <Name>
    Tells the soft not to add the INPUT tag of Name in the RTGetForm command of the same bloc.

SetCookie <Phase> <Domain>-<Path>-<Name>=<Value>
    Adds a static cookie for Path (not NULL, use / for whole path) in Domain : Name=Value. The cookie will be added starting at Phase (the first one is 1).

GO  Marks the end of a bloc.

Search <text>
    Tells the soft to look for text in the response of our sent request. Must be followed be ErrorMsg or PrintMsg. Only ONE Search per bloc (for more searches, use ElseSearch after this one).

ElseSearch <text>
    Tells the soft that there are more than one search to perform (Do not forget to use a Search before this ElseSearch). Must be followed by ErrorMsg or PrintMsg.

Else
    Tells the soft what to do if no search matched. Must be followed by ErrorMsg or PrintMsg.

ErrorMsg <num> <message>
    Tells the soft to display message before exiting with the error code num, if the search matched.

PrintMsg <message>
    Tells the soft to display message before continuing, if the search matched.

DYNAMIC REPLACEMENTS
Here comes what is the more powerful with SmsSend : dynamic replacements. a Dynamic replacements is defined like this : Name[-param]*% The name must be the name of an argument (no alias in name !), or the name of an internal command. Most internal commands requiere parameters, wich are separated by '-'. Here is the list of these commands :

RTURL-<num>
    Replaces the URL which was sent during phase num (the first phase being 1, and automatic redirect being counted).

RTParams-<num>
    Replaces the data which was sent during phase num (the first phase being 1, and automatic redirect being counted).

RTHost-<num>
    Replaces the hostname which was used during phase num (the first phase being 1, and automatic redirect being counted).

RTFollowLink-<num>-<name>
    Replaces with URL of link name searched in the result from phase num (the first phase being 1, and automatic redirect being counted).

RTGetInput-<num>-<name>
    Replaces with the VALUE field of the INPUT tag of NAME name searched in the result from phase num (the first phase being 1, and automatic redirect being counted).

RTFormAction-<num>-<ind>
    Replaces with the ACTION field of the form ind (the first form being 0) searched in the result from phase num (the first phase being 1, and automatic redirect being counted).

RTGetForm-<num>-<ind>
    Replaces with ALL INPUTs (NAME=VALUE) of the form ind (the first form being 0) searcged in the result from phase num (the first phase being 1, and automatic redirect being counted). Except for all replacements already made (in the SAME command) if the NAME field of the INPUT tag in found in the replacements done (aliases are very useful here, if the NAME field have an awful name, and we wish to replace it with the Login argument of the script for example). In the same way, all NoAdd values defined in the same bloc are not added.

RTGetString-<num>-<textBefore>
    Replaces with string found juste after textBefore (after removing spaces and string delimiters) searched in the result from phase num.

RTSubURL-<num>-<sub>
    Replaces with sub th sub part (a sub part is delimited by a /, the first one is just after domain name) searched in the url from phase num.

RTFollowFrame-<num>-<name>
    Replaces with url of frameset of name searched in the result from phase num.

EXAMPLE
Here is a script example of smssend :
## SkySMS provider file - www.kiwee.com ##
# Version 1.03
# by Ze KiLleR <zekiller@skytech.org>
# Error codes :
#  1 -> Bad Login/Password
#  2 -> Daily message quota exceeded
#  3 -> ASP/SQL timeout
#  4 -> Error sending message
NbParams 5
%Login : Your login from www.kiwee.com
%Password Hidden : Your password
%Pseudo : Kiwee Pseudo of recipient
%Type : Type of sms : 0 (flash sms) or 2 (normal sms)
%Message Size=125 Convert : Your message
# Logging on Kiwee
GetURL http://www.kiwee.com/sms/
GO
PostURL http://www.kiwee.com/Verifmembre.asp
PostData LoginName=Login%&Password=Password%
Search  votre pseudo et/ou votre mot de passe
ErrorMsg 1 Bad login and/or password
GO
GetURL http://www.kiwee.com/sms/
GO
# Sending message
PostURL http://www.kiwee.com/sms/sendsms.asp
Params previous=sms.asp
Referer http://www.kiwee.com/sms/
PostData from=Login%&topseudo=Pseudo%&PhoneNumber=&class=Type%&message=Message%&arandom=2
Search confirmsms.html
PrintMsg Message successfully sent
ElseSearch atteint votre limite d'envoi
ErrorMsg 2 Daily message quota exceeded
ElseSearch Timeout expired
ErrorMsg 3 ASP/SQL timeout
Else
ErrorMsg 4 Error sending message
GO

SEE ALSO
smssend(1)

COPYRIGHTS
Copyright (c) 2000'01 - Christophe "Ze KiLleR" Calmejane <zekiller@skytech.org> Distributed under GNU General Public License v2; see COPYING file for more informations.

AUTHORS
Christophe "Ze KiLleR" Calmejane <zekiller@skytech.org>