Example code for SMS integration in language VB.net

Send SMS - REST API - JSON

            
Dim myReq As HttpWebRequest
Dim myResp As HttpWebResponse

myReq = HttpWebRequest.Create("https://api.labsmobile.com/json/send")
myReq.Method = "POST"
myReq.ContentType = "application/json"
myReq.Headers.add("Authorization", "Basic " & Convert.ToBase64String(Encoding.UTF8.GetBytes("myusername:mypassword")))

Dim myData As String = "{\"message\":\"Text of the SMS message\", \"tpoa\":\"Sender\",\"recipient\":[{\"msisdn\":\"12015550123\"},{\"msisdn\":\"447400123456\"},{\"msisdn\":\"5212221234567\"}]}"

myReq.GetRequestStream.Write(System.Text.Encoding.UTF8.GetBytes(myData), 0, System.Text.Encoding.UTF8.GetBytes(myData).Count)
myResp = myReq.GetResponse

Dim myreader As New System.IO.StreamReader(myResp.GetResponseStream)
Dim myText As String

myText = myreader.ReadToEnd

Credit inquiry - REST API - JSON

            
Dim myReq As HttpWebRequest
Dim myResp As HttpWebResponse

myReq = HttpWebRequest.Create("https://api.labsmobile.com/json/balance")
myReq.Method = "GET"
myReq.ContentType = "application/json"
myReq.Headers.add("Authorization", "Basic " & Convert.ToBase64String(Encoding.UTF8.GetBytes("myusername:mypassword")))

myResp = myReq.GetResponse

Dim myreader As New System.IO.StreamReader(myResp.GetResponseStream)
Dim myText As String

myText = myreader.ReadToEnd

Send SMS - HTTP/GET

                
Imports System.Net
Imports System.IO
Dim client As WebClient = New WebClient
client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)")
client.QueryString.Add("username", "xx@xx.xxx")
client.QueryString.Add("password", "xxxxxxxx")
client.QueryString.Add("msisdn", "xxxx")
client.QueryString.Add("message", "This is an example message")
Dim baseurl As String = "http://api.labsmobile.com/get/send.php"
Dim data As Stream = client.OpenRead(baseurl)
Dim reader As StreamReader = New StreamReader(data)
Dim s As String = reader.ReadToEnd()
data.Close()
reader.Close()
Return

Credit inquiry - HTTP/GET

                
Imports System.Net
Imports System.IO
Dim client As WebClient = New WebClient
client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)")
client.QueryString.Add("username", "xx@xx.xxx")
client.QueryString.Add("password", "xxxxxxxx")
Dim baseurl As String = "http://api.labsmobile.com/get/balance.php"
Dim data As Stream = client.OpenRead(baseurl)
Dim reader As StreamReader = New StreamReader(data)
Dim s As String = reader.ReadToEnd()
data.Close()
reader.Close()
Return

Send SMS - WebService

Within the VisualStudio.net program, in section Solution Explorer click on Add Service Reference. Copy the following URL: http://api.labsmobile.com/ws/services/LabsMobileWsdl.php?wsdl. Create a name for the Namespace for example"LabsMobileAPI".

                
 Dim res As String = New client.LabsMobileAPI.SendSMS(
    "priv00x",
    "xx@xx.xxx",
    "xxxxxxxx",
    "<sms>
        <recipient>
            <msisdn>34609827393</msisdn>
        </recipient>
        <message><![CDATA[This is an example message]]></message>
    </sms>")

Credit inquiry - WebService

Within the VisualStudio.net program, in section Solution Explorer click on Add Service Reference. Copy the following URL: http://api.labsmobile.com/ws/services/LabsMobileWsdl.php?wsdl. Create a name for the Namespace for example"LabsMobileAPI".

                
 string resultado = new Client.LabsMobileAPI.GetCredit(
    "xx@xx.xxx",
    "xxxxxxxx")
  • contact form support

    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.

    Create new account
  • Marketing agency, Events and SMS marketing campaigns recommends LabsMobile

    Bulk SMSLanding messaging campaigns for large brands, and to hold and manage sporting events.

    Watch more reviews
  • dashboard aplicación online

    Maximum reliability at the best price

    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.

    Check our rates
  • dashboard aplicación online

    Need more info? Contact us!

    Our technical department has professionals with years of experience and we have made multiple integrations.

    We guide and help you through the process.

    Request technical support
  • Create a personalized SMS sending

    This tutorial explains how to send SMS messages to a mobile phone database by customizing the message text with variables.

    Ir al tutorial
loader