SMS and MMS Toolkit - SmsProtocolHttp object

Overview

With the easy-to-use SMS/HTTP interface you can send SMS messages directly from your business applications or websites in minutes. All you need is a subscription with a commercial HTTP-compliant SMS provider, and an internet connection.

You can send different types of SMS messages through HTTP:

The SmsProtocolHttp object features the following:

The SmsProtocolHttp object is part of the ActiveXperts SMS and MMS Toolkit component. Overview of all SMS and MMS Toolkit objects:

Sample code

VBScript sample: Send a simple SMS message via HTTP

Set objHttpProtocol = CreateObject( "ActiveXperts.SmsProtocolHttp" )
Set objSmsMessage = CreateObject( "ActiveXperts.SmsMessage" )

' Provider Settings
objHttpProtocol.ProviderHost = "post.activexperts-labs.com" ' Specify host
objHttpProtocol.ProviderPort = 8080 ' Specify port (default port:80)
  
' Provider Response templates
objHttpProtocol.ProviderErrorResponse = "ERR" ' Response should NOT contain 'ERR'
objHttpProtocol.ProviderSuccessResponse = "id" ' Response should contain 'id'

' URL Template to submit plain text SMS messages
objHttpProtocol.URLText = "/sendsms/default.asp?username=AX008&password=812056&text=" & _
                                 "%MESSAGEDATA%&to=%MESSAGERECIPIENT%&from=%MESSAGESENDER%"   
objSmsMessage.Clear
objSmsMessage.Recipient = "+31624896641" ' Recipient's mobile number
objSmsMessage.Data = "Hello, world!" ' SMS message text
objSmsMessage.Sender = "+31638740160" ' Message sender   

objHttpProtocol.Send( objSmsMessage ) ' Send the message   
WScript.Echo "Send, result:" & objHttpProtocol.LastError ' Display the result  
WScript.Echo "Provider response:" & objHttpProtocol.ProviderResponse ' Show provider response

VB .NET sample: Send a simple SMS message via HTTP-POST

Imports AXmsCtrl

Module Module1
 Sub Main()

  Dim objHttpProtocol As SmsProtocolHttp = New SmsProtocolHttp
  Dim objSmsMessage As SmsMessage = New SmsMessage


 ' Provider Settings
  objHttpProtocol.ProviderHost = "post.activexperts-labs.com" ' Specify host
  objHttpProtocol.ProviderPort = 8080 ' Specify port (default port:80)

 ' Provider Response templates
  objHttpProtocol.ProviderErrorResponse = "ERR" ' Response should NOT contain 'ERR'
  objHttpProtocol.ProviderSuccessResponse = "id" ' Response should contain 'id'

 ' URL Template to submit plain text SMS messages
  objHttpProtocol.URLText = "/sendsms/default.asp?username=AX008&password=812056&text=" & _
                           "%MESSAGEDATA%&to=%MESSAGERECIPIENT%&from=%MESSAGESENDER%"   

  objSmsMessage.Data = "ActiveXperts SMS and MMS Toolkit HTTP-Post test message!"
  objSmsMessage.Sender = "+31625044454"
  objSmsMessage.Recipient = "+31624896641"

  objHttpProtocol.Send( objSmsMessage ) ' Send the message   
  Console.WriteLine("Send, result: {0} ( {1} )", 
          objHttpProtocol.LastError.ToString, 
          objHttpProtocol.GetErrorDescription(objHttpProtocol.LastError) )
 End Sub
End Module

More samples

Samples are available for: Visual Basic, Visual C/C++, VB .NET, VC# .NET, ASP, ASP .NET, Borland C++ Builder, Boland Delphi, ColdFusion, Java, Javascript, PHP, HTML and more. On ftp.activexperts-labs.com, you can find many SMS and MMS Toolkit samples. Samples are also part of the SMS and MMS Toolkit installation.