Advanced Services - SMS Connectivity

ASP VBScript Sample application using HTTP to send an SMS text message

HSL Mobile Messaging

The following sample application written in ASP VBScript sends an SMS text 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").

<% Option Explicit %>

<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
Const host = "sms.haysystems.com"
Const port = "80"
Const action = "sendtxt"
Const client_id = "<your client_id>"
Const text = "this is a test message"
Const destaddr = "<some fully-qualified MSISDN>"
Const password = "<your secret>"

Dim url
Dim query
Dim xml
Dim result

' 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.
url = "http://" & host & ":" & port & "/" & action & "/"
query = "client_id=" & client_id & "&text=" & Server.UrlEncode(text) _
	& "&destaddr=" & destaddr & "&password=" & password

' Create instance of the Inet control
Set 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_http_example_vbscript.asp


Copyright © Hay Systems Ltd 2009

Owner: support@haysystems.com 20 September 2004

Sample code link | Developers section link