RunCodes
Programming & Tech

How to Send Free SMS From VB.NET using SMS API?

5 5,838

As you all know guyz, the era that we are living is an era of internet, so everyone is hanging on their PC all the time. Everyday we are sending some SMS to our friends in order to inform something to them. So, if there is some method that can send SMS for free, everyone gonna use that method and loved it. Today, in this tutorial we are gonna discuss about that method but we are gonna send that message using our own program (VB.NET). And also if you wanna send the message to your friends without displaying your number and name, this tutorial is for you! sometime we are in the mode of cracking jokes and wanna fool your friends or sending some threatening message(only for entertainment purpose otherwise it will be illegal) you can use this method.

“This tutorial may be very useful for those who want to integrate SMS features in their project which is developed in VB.NET”.

For sending SMS using SMS API approach: you have to do two task:

1.   Selecting Carrier

2.    Writing code

we are selecting txtlocal as our carrier. So, All you have do is go to http://www.txtlocal.co.uk and there you need to create one account. after creating account. (you need to fill up some of your information and txtlocal will send you a verification email into your email and verify your account [watch the video for detail]). After completing this step, go http://api.txtlocal.com/docs/sendsms and from the select language option choose VB.NET and then copy the code and edit as in the following manner or simply copy the following code but you need to provide your own api key when you run this project.

After doing this, you complete the task of selecting your carrier. Now write the following piece of code after designing the following form in Visual Studio.

STEPS:

[sociallocker]

1. I am assuming that you have Visual Studio, Open your Visual Studio and click on File>new project, From the left side of your window, select Visual Basic>Windows and from the middle side select Windows Forms Application and then give the name of your project and then click OK which is shown in below.

2. From the ToolBox Drag and Drop four label, four Textbox and one button in your form and change the properties of these controls by selecting each control and right click that particular control and click on properties.

Four Label for phone no, api key, sender, message
Four Textbox for phone no, api key, sender, message
one Button to send

NOTE: You can increase the message box large for this select message box textbox go to properties and then change the multiline to true and ScrollBars to Both and then expand this textbox by dragging it. The designed form look like:

How to send free sms using VB.NET?

3. Double click on the Send button to go to the .vb section of your project and scroll up and then import the following namespace to your program as:

Imports System.Net
Imports System.Web
Imports System.Collections.Specialized
Imports System.IO
Imports System.Text

4. Write the following piece of code inside the clicking event of Send Button:


Dim apikey = txtAPI.Text
Dim message = txtMsg.Text
Dim numbers = txtNum.Text
Dim strGet As String
Dim senderName = txtSend.Text
Dim url As String = "https://api.txtlocal.com/send/?"

strGet = url + "apikey=" + apikey _
+ "&numbers=" + numbers _
+ "&message=" + WebUtility.UrlEncode(message) _
+ "&sender=" + senderName

Dim webClient As New System.Net.WebClient
Dim result As String = webClient.DownloadString(strGet)
MessageBox.Show(result, "INFORMATION", MessageBoxButtons.OK, MessageBoxIcon.Information)

5. Now Login to the your txtlocal account, goto setting>API KEY and then click on create API Key and then simply copy that created key.

6. Run your project by clicking in that play button. Input your API Key, Sender Name, Message, Phone number with country code in the respective textbox and then click on Send button. That’s it.

May be after sending 10 SMS your credit will be finished! but don’t be sad you can send more and more SMS but you need to create another account with another email account in www.txtlocal.co.uk ! that’s it. you may not be that much happy to hear this (sending only 10 SMS) but don’t forget you are able to send these 10 SMS for free and also there is one line “To get something, you must lose something”. it means you have to spend some time in creating account in txtlocal.co.uk in order to send free SMS.

[/sociallocker]

Finally, if you guyz think, this is awesome tutorial and help you in some extend please share this tutorials with your all friend so that they can know about this method of sending SMS!

if you have any confusion, you can watch the following video:

Show Comments (5)