Advanced Services - SMS Connectivity

ASP VBScript Sample application using HTTP to send an EMS message

HSL Mobile Messaging

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

<% Option Explicit %>

<html>
<head>
    <title>
    Simple VBScript (ASP) example of UCS2 via 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 = "submitsm"
Const client_id = "<your client_id>"
Const destaddr = "<some fully-qualified MSISDN>"
Dim shortmessage
shortmessage = "7C0C7A00424547494E3A494D454C4F44590D0A56455253494F4E3A312E320" _
             & "D0A464F524D41543A434C415353312E300D0A4D454C4F44593A6433236333" _
             & "6433236333643372326433236333643365332366336533236633673361332" _
             & "36733613323673361337232613323673361330D0A454E443A494D454C4F44" _
             & "590D0A"
Const password = "<your secret>"

Dim url
Dim query
Dim xml
Dim result

' Build and encode the URL.
url = "http://" & host & ":" & port & "/" & action & "/"
query = "client_id=" & client_id & "&destaddr=" & destaddr & "&esm=64" _
	& "&shortmessage=" & shortmessage & "&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_ems_http_example_vbscript.asp


Copyright © Hay Systems Ltd 2004

Owner: support@haysystems.com 20 September 2004

Sample code link | Developers section link