|
Advanced Services - SMS Connectivity ASP JScript Sample application using HTTP to send a picture message |
![]() |
The following sample application written in ASP JScript sends a picture 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 for access to 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 = "sendnok";
var client_id = "<your client_id>";
var destaddr = "<some fully-qualified MSISDN>";
var type = "pg";
var content = "50340a232043726561746564206279205061696e742053686f702050726f20";
content += "370a37322032380a0000000000000000000003ffffffffffffff0000000000";
content += "0000000000e0000000000000000338000000000000000cee00000000000000";
content += "131b01f81f8fe7c0006c06c0600618630000f001e0600630230000e000e060";
content += "0630030000e000e0600618030000e000e060061c030000e000e060060f0300";
content += "00e000e07ffe07830000e000e0600601c30000e000e0600600e30000e000e0";
content += "600600730000e000e0600600730000e000e0600620730080f001e0600630e3";
content += "01807c07c1f81fbf87ff801f1f000000000000000ffe0000000000000003f8";
content += "0000000000000000e0000000000000000000000000000000000003ffffffff";
content += "ffffff000000000000000000";
var text = "this is a test message";
var password = "<your secret>";
// Build and encode the URL.
// Note we are careful to URL-encode the message content as it is
// the only part of the URL likely to contain reserved characters.
var url = "http://" + host + ":" + port + "/" + action + "/";
var query = "client_id=" + client_id + "&destaddr=" + destaddr + "&type="
+ type + "&content=" + content + "&text=" + Server.UrlEncode(text)
+ "&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_picture_message_http_example_jscript.asp
Copyright © Hay Systems Ltd 2004
Owner: support@haysystems.com 20 September 2004