Perl SMS Script
Code Sample:
#!/usr/bin/perl
use LWP::Simple;
use URI::Escape;
use CGI qw/:standard/;
# WARNING - there is no security on input here (to, from, message) - this is a
# demonstration script only.
# Your parameters
my = "YourMobileID";
my = "YourPassword";
# The API URL
my ="http://api.aussiesms.com.au/";
# Variable parameters (in this case from CGI Get or Post or Command line)
my = uri_escape(param('message'));
my = param('to');
# Send an SMS (every call must have valid ID and Password)
my = "?sendsms&mobileID=&password=&to=&text=&from=&msg_type=SMS_TEXT";
my = get();
# Check response
if ( =~ /MessageID:(\d+)/) {
# Valid response, now check status of SMS message
my = $1;
= "?querymessage&mobileID=&password=&msgid=";
= get();
if ( =~ /(\d)+:(.+)$/) {
print "Message Status for : $1 - $2
";
}
else {
print "send message failed for -
";
}
}
else {
# Invalid response - assume authentication has failed
print "Authentication failure:
";
}
----------------------------------------------------
HTML Sample:
<html>
<body>
<form method="get" action="/cgi-bin/aussiesms.cgi">
To: <input name="to">
Message: <input name="message">
<input type="submit">
</form>
</body>
</html>
Supplied by: Scott Penrose (http://scott.dd.com.au/wiki/AussieSMS)