Visual Basic.NET

white

Visual Basic .NET API

The best way to use the Red Oxygen API from VB.NET is to use the HTTP interface.

Example

Public Shared Function SendSms(ByVal AccountID As String, ByVal Email As String, ByVal Password As String,
ByVal Recipient As String, ByVal Message As String) As Integer
 
	Dim Client As WebClient = New WebClient
	Dim URL As String
 
	URL = ("http://www.redoxygen.net/sms.dll?Action=SendSMS" _
		+ "&AccountId=" + AccountID _
		+ "&Email=" + Email _
		+ "&Password=" + Password _
		+ "&Recipient=" + Recipient _
		+ "&Message=" + Message)
 
	Dim Response() As Byte = Client.DownloadData(URL)
	Dim Result As String = Encoding.ASCII.GetString(Response)
	Dim ResultCode As Integer = System.Convert.ToInt32(Result.Substring(0, 4))
 
	Return ResultCode
 
End Function

Properties

Name Type Description Example
AccountId String This is your Red Oxygen Account ID, which uniquely identifies your account. CI00000001
Email String This is the email address of your Red Oxygen user account. It is also the address that will receive replies to the sent SMS. username@company.com
Password String This is the password of your Red Oxygen user account. secret
Recipient String The destination mobile numbers. Multiple recipients can be specified comma separated. 61409000000,61419718927,61419718972
Message String A single SMS has a maximum length of 160 characters. If the message is greater than 160 characters then multiple SMS will be sent as a concatenated SMS which will result in an additional charge for the additional messages. The maximum length of a message is 765 characters. If you exceed this limit only the first 765 characters of your message will be sent. Server 23 is offline.

Example Call

Module Module1
 
    Sub Main()
 
        Dim result As Integer
        result = RedOxygen.SendSms("CI00001234",
                                   "username@company.com",
                                   "MyPassword",
                                   "61409000000,614090000001",
                                   "Hello from VB.NET")
 
    End Sub
 
End Module

If you get a compile error “error BC30456: ‘HttpUtility’ is not a member of ‘Web’.”, then you will need to.

  1. Project|Add Reference
  2. Choose the .NET tab
  3. Select “System.Web.dll” from the list.

For more details see the Red Oxygen API HTTP User Guide.

Want us to set it up for you?

Get in touch with our team and we will get back to you as soon as possible!

    white