Visual Basic .NET API
The best way to use the Red Oxygen API from VB.NET is to use the HTTP interface.
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
|AccountId||String||This is your Red Oxygen Account ID, which uniquely identifies your account.||CI00000001|
|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.||firstname.lastname@example.org|
|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.|
Module Module1 Sub Main() Dim result As Integer result = RedOxygen.SendSms("CI00001234", "email@example.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.
- Project|Add Reference
- Choose the .NET tab
- Select “System.Web.dll” from the list.
For more details see the Red Oxygen API HTTP User Guide.