Advanced Services - SMS Connectivity

ASP VBScript Sample application using HTTP to send a picture message

HSL Mobile Messaging

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

<% Option Explicit %>

<html>
<head>
    <title>Simple VBScript (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 = "sendnok"
Const client_id = "<your client_id>"
Const destaddr = "<some fully-qualified MSISDN>"
Const content_type = "pg"
Dim content
content = "50340a232043726561746564206279205061696e742053686f702050726f20370" _
        & "a37322032380a0000000000000000000003ffffffffffffff0000000000000000" _
        & "0000e0000000000000000338000000000000000cee00000000000000131b01f81" _
        & "f8fe7c0006c06c0600618630000f001e0600630230000e000e0600630030000e0" _
        & "00e0600618030000e000e060061c030000e000e060060f030000e000e07ffe078" _
        & "30000e000e0600601c30000e000e0600600e30000e000e0600600730000e000e0" _
        & "600600730000e000e0600620730080f001e0600630e301807c07c1f81fbf87ff8" _
        & "01f1f000000000000000ffe0000000000000003f80000000000000000e0000000" _
        & "000000000000000000000000000003ffffffffffffff000000000000000000"
Const text = "this is a test message"
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 & "&type=" _
	& content_type & "&content=" & content & "&text=" & Server.UrlEncode(text) _
	& "&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_picture_message_http_example_vbscript.asp


Copyright © Hay Systems Ltd 2004

Owner: support@haysystems.com 20 September 2004

Sample code link | Developers section link