SMS Component - Http object

Overview

Some SMSC's or SMS provider have a custom HTTP (Hypertext Transfer Protocol) based API for sending out large volumes of SMS messages through the internet. This is usually done because the HTTP protocol is relatively easy to configure and most system adminstrators already have some familiarity with this protocol.

The HTTP object in the SMS Component has two modes of operation. First, the option to define a 'template' for SMS submissions by filling out the SMSC URL and POST strings. Keywords will be used where different fields from the SMS object should be inserted. Second, there's the Get and Post operations themselves. This method does not use keyword or the SMSMessage object but it allows you to have a very convenient interface to issue Get and Post operations directly.

The Http object features the following:

The Http object is part of the ActiveXperts SMS Component. Overview of all SMS Component objects:

Sample code

VBScript sample: Send a simple SMS message via HTTP using a Template

Option Explicit

' Declare objects
Dim objHttp, objMessage, objSmsConstants

' Create Objects
Set objHttp                   = CreateObject ( "AxSms.Http" )
Set objMessage                = CreateObject ( "AxSms.Message" )
Set objSmsConstants           = CreateObject ( "AxSms.Constants" )

' Configure the HTTP protocol object for sending out SMS messages
objHttp.Url = "http://post.activexperts-labs.com:8080/sendsms/default.asp"
objHttp.PostBody = "username=CE658B84&password=FAC1982E&text=" & _
  objConst.HTTP_PLACEHOLDER_BODY & "&to=" & objConst.HTTP_PLACEHOLDER_TOADDRESS

' SMS Message Properties
objMessage.BodyFormat         = objSmsConstants.BODYFORMAT_TEXT

objMessage.ToAddress          = "+31612345678"
objMessage.Body               = "Hello, world!"

WScript.Echo objHttp.SendSms( objMessage )
WScript.Echo "SendSms, result: " & objHttp.LastError
WScript.Echo "Response: " & objHttp.LastResponseCode

WScript.Echo "Ready"

VBScript sample: Send a simple SMS message via HTTP using direct 'Post'

Option Explicit

' Declare objects
Dim objHttp

' Create Objects
Set objHttp                   = CreateObject ( "AxSms.Http" )

WScript.Echo objHttp.Post("http://post.activexperts-labs.com:8080/sendsms/default.asp", _
  "username=CE658B84&password=FAC1982E&text=Hello+World&to=316112233445")

WScript.Echo "Post, result: " & objHttp.LastError
WScript.Echo "Response: " & objHttp.LastResponseCode

WScript.Echo "Ready"

More samples

Samples are available for: C# .NET, Visual Basic .NET, Visual C/C++, VBA, ASP, ASP .NET, Java, Javascript, PHP, HTML, ColdFusion, Delphi and more.

On ftp.activexperts-labs.com, you can find many SMS Component samples. Samples are also part of the SMS Component installation.