SMS Command Line Interface? Search Search

Now SMS/MMS Gateway » Now SMS/MMS Gateway - SMS Issues (Product Support Only) » Archive through September 15, 2003 » SMS Command Line Interface? « Previous Next »

Author Message
Alex
Posted on Thursday, June 12, 2003 - 08:09 pm:   

Dear Sir,

Does Now SMS support to send SMS via command line?

My network management system could send SNMP trap and executed script.

How could I trigger the alert to be sent by Now SMS?

Best regards,

Alex
Bryce Norwood - NowSMS Support
Posted on Thursday, June 12, 2003 - 08:16 pm:   

Hi Alex,

We have an HTTP command interface in NowSMS, where you can send a message by issuing an HTTP GET request to the gateway. (At a very simple level, this is a matter of connecting to the configured port on the gateway and issuing a command "GET /?PhoneNumber=xxxx&Text=text+of+message HTTP/1.0\r\n\r\n". Note that the text needs to be URL escaped according to HTTP specifications.)

If you're in the Windows environment, and you need to send a message through a command line interface, you could use simple scripting to create a script that runs from a command line interface.

For example, here's a real simple script.

Save the following with a file name of "sms.js", and modify the last line of the script to reference your NowSMS server, the phone number you want to send to, and the text of the message (with a little more work, you could turn those fields into variables for the script).

----- begin sms.js -----
function HTTPGET(strURL)
{
var strResult;

try
{
// Create the WinHTTPRequest ActiveX Object.
var WinHttpReq = new ActiveXObject("Msxml2.XMLHTTP" /* or "WinHttp.WinHttpRequest.5"*/);

// Create an HTTP request.
var temp = WinHttpReq.Open("GET", strURL, false);

// Send the HTTP request.
WinHttpReq.Send();

// Retrieve the response text.
strResult = WinHttpReq.ResponseText;
}
catch (objError)
{
strResult = objError + "\n"
strResult += "WinHTTP returned error: " +
(objError.number & 0xFFFF).toString() + "\n\n";
strResult += objError.description;
}

// Return the response text.
return strResult;
}

WScript.Echo(HTTPGET("http://mms.host.ip:port/?PhoneNumber=phonenumber&User=user name&password=password&text=SNMP+Trap+has+occurred"));

----- end sms.js -----

Then, you can run "cscript sms.js", which loads the Windows script host (cscript.exe) to process this script.

Hope that helps!

-bn

Search Search Tree View Tree View   Home Home
Login Login / Register Topics Topics Search Last 1|3|7 Days   Previous Page Previous Next Next Page

© Copyright 2002-2008 by NowMobile.com Limited
Airport House, Purley Way, Croydon, London, CR0 0XZ, UK
UK Tel: +44-20-8286-8080 US Tel: +1.410.833.8711
email : nowsms@nowsms.com