Shortcut Menu

Skip

Main Navigation

Choose your language

You are here:

ActiveXperts.com > SMS Component > Objects > Http

ActiveXperts SMS Component Add SMS capabilities to any Windows or .NET application

Quicklinks


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:

  • Send SMS Messages directly to the SMSC using HTTP 'Post' or 'Get' requests.
  • Support for text and binary data
  • Templates for WAPPush and vCard messages
  • Support for proxy servers and secure web sites
  • Support password protected web sites
  • Internal connection pool for maximum performance

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

  • Gsm - Send and receive SMS messages using a GSM modem or a modem-capable GSM phone.
  • Smpp - Send and receive SMS messages via an SMPP provider.
  • SmppServer - Accept incoming SMPP connections.
  • Http - Send SMS messages through an HTTP based SMSC provider interface over the internet.
  • Dialup - Send SMS messages using a Hayes compatible modem through TAP/XIO or UCP.
  • Snpp - Send pager messages via an SNPP provider through the internet/VPN.

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.