Advanced Services - SMS Connectivity

ASP JScript Sample application using HTTP to send an EMS message

HSL Mobile Messaging

The following sample application written in ASP JScript sends an EMS message to a single mobile telephone. The application uses HTTP to communicate with HSL's systems. To send to more than one mobile telephone at a time, separate each mobile number in the destaddr field by a comma (e.g. "447968000111,447720000111,3378100100").

<%@ Language = JScript%>

<html>
<head>
    <title>
    Simple JScript (ASP) example of EMS via the HSL HTTP interface
    </title>
</head>
<body>

<%
// These variables fill out the various parts described in the
// interface specification
var host = "sms.haysystems.com";
var port = "80";
var action = "submitsm";
var client_id = "<your client_id>";
var destaddr = "<some fully-qualified MSISDN>";
var shortmessage = "7C0C7A00424547494E3A494D454C4F44590D0A56455253494F4E3A312E"
    + "320D0A464F524D41543A434C415353312E300D0A4D454C4F44593A64332363336433236"
    + "33364337232643323633364336533236633653323663367336133236733613323673361"
    + "337232613323673361330D0A454E443A494D454C4F44590D0A";
var password = "<your secret>";

// Build and encode the URL.
var url = "http://" + host + ":" + port + "/" + action + "/"
var query = "client_id=" + client_id + "&destaddr=" + destaddr + "&esm=64"
	+ "&shortmessage=" + shortmessage + "&password=" + password;

// Create instance of the Inet control
var xml = Server.CreateObject("Microsoft.XMLHTTP");

xml.Open("POST", url, false);
xml.Send(query);

// Make the request and print the result
Response.Write("<p>Submission result: ");
Response.Write(xml.responseText);
Response.Write("</p>");
%>

</body>
</html>

super_simple_ems_http_example_jscript.asp


Copyright © Hay Systems Ltd 2004

Owner: support@haysystems.com 20 September 2004

Sample code link | Developers section link