Sign up!
Create a user account and send your SMS messages in seconds. You will have all the functionalities and benefits in the same platform.
Send from API and manage your account with our online application WebSMS.
Below you will find the examples of programming code in the language Visual Basic to send SMS messages through the API of the LabsMobile platform.
You also have code examples in VB.net and other programming languages.
We recommend you to consult and take into account the following resources and help in your integration:
Example of sending for the GET version of the LabsMobile SMS API. This is a basic and simple method of sending SMS messages from an application or software created in Visual Basic passing all the parameters in the same url.
It is important to encode all the values as url (with the function urlencode() for example).
You can see and download the GET API manual of LabsMobile in the following URL: https://www.labsmobile.com/en/api-sms/api-versions/http-get
Public Function SendSMSLabsMobile(Sender As String, Phone As String, SendDateTime As String, Message As String, Test As String, AllowLongMessage As String) As String Dim SendString As String Dim ResultCall As String Dim gAccountLM As String = "account@domain.com" Dim gPasswordLM As String = "password" If SendDateTime = "" Then SendString = "http://api.labsmobile.com/get/send.php" & _ "?username=" & gAccountLM & _ "&password=" & gPasswordLM + _ "&sender=" & Sender + _ "&long=" & LongMessage + _ "&test=" & Test + _ "&msisdn=" & Phone + _ "&message=" + ozURLEncode(Message) Else SendString = "http://api.labsmobile.com/get/send.php" & _ "?&username=" & gAccountLM & _ "&password=" & gPasswordLM + _ "&sender=" & Sender + _ "&scheduled=" & SendDateTime + _ "&long=" & LongMessage + _ "&test=" & Test + _ "&msisdn=" & Phone + _ "&message=" + ozURLEncode(Message) End If ResultCall = SendRequest(SendString) If Trim(ResultCall) <> "" Then Dim x As Long: Dim y As Long Dim CodeRes As String: Dim TmpCodeRes As String x = InStr(1, ResultCall, "<Code>", vbTextCompare) If x = 0 Then CodeRes = 99 Else TmpCodeRes = Mid(ResultCall, x + 6, 4) y = InStr(1, TmpCodeRes, "<", vbTextCompare) CodeRes = Mid(TmpCodeRes, 1, y - 1) End If Select Case Val(CodeRes) Case 0 SendSMSLabsMobile = "Ok" Case 30 SendSMSLabsMobile = "There was an error while sending the message" Case 35 SendSMSLabsMobile = "No enough credit" Case 36 SendSMSLabsMobile = "Incorrect phone number" Case 37 SendSMSLabsMobile = "The account has reached the maximum number of sendings per day" Case 39 SendSMSLabsMobile = "Incorrect scheduled datetime" Case 40 SendSMSLabsMobile = "The user cannot send scheduled messages" Case 41 SendSMSLabsMobile = "You cannot send scheduled messages in test mode" Case Else SendSMSLabsMobile = "Unexpected error - Message not sent" End Select End If End Function Public Function SendRequest(ByVal strUrl As String) As String Dim ozData As String Dim ozConnOpen As Long, ozGetFile As Long Dim ozReturnValue As Long, ozBuffer As String * 128 ozConnOpen = InternetOpen("Ozeki HTTP client", 1, vbNullString, vbNullString, 0) ozGetFile = InternetOpenUrl(ozConnOpen, strUrl, vbNullString, 0, &H4000000, 0) If ozGetFile = 0 Then MsgBox "Unviable connection", vbExclamation, "Error" Exit Function End If InternetReadFile ozGetFile, ozBuffer, 128, ozReturnValue ozData = ozBuffer Do While ozReturnValue <> 0 InternetReadFile ozGetFile, ozBuffer, 128, ozReturnValue ozData = ozData + Mid(ozBuffer, 1, ozReturnValue) Loop InternetCloseHandle ozGetFile InternetCloseHandle ozConnOpen SendRequest = ozData ozData = "" End Function Public Function ozURLEncode(ByVal Text As String) As String Dim i As Integer Dim ozCode As Integer Dim char As String ozURLEncode = Text For i = Len(ozURLEncode) To 1 Step -1 ozCode = Asc(Mid$(ozURLEncode, i, 1)) Select Case ozCode Case 48 To 57, 65 To 90, 97 To 122 ' Do not replace the alphanumeric characters Case 32 ' Replace the space character with "+" Mid$(ozURLEncode, i, 1) = "+" Case Else ' Replace the national characters with a percent sign and the characters hexadecimal Value ozURLEncode = Left$(ozURLEncode, i - 1) & "%" & Hex$(ozCode) & Mid$ _ (ozURLEncode, i + 1) End Select Next End Function
Create a user account and send your SMS messages in seconds. You will have all the functionalities and benefits in the same platform.
Send from API and manage your account with our online application WebSMS.
Sending access codes, authentication, user identification and validation processes with SMS messages.
At LabsMobile we only offer direct routes of maximum reliability and quality. Enjoy our platform and all our services for the price of an SMS.
Pay ONLY for sent messages.
Our technical department has professionals with years of experience and we have made multiple integrations.
We guide and help you through the process.
This tutorial explains how to send a survey or user evaluation (review) through SMS messages.