Hi nirmal90,
Using the API https://smsapi.engineeringtgr.com/
Step 1: Register on Way2SMS.
- Register on way2sms.com if not register.
- Goto http://way2sms.com and create an account. Therefore you got password on your mobile number. This mobile number and password use in the API.
Step 2: Generate API Key.
Step 3: Run API.
Refer below code.
Namespaces
C#
using System.IO;
using System.Net;
VB.Net
Imports System.IO
Imports System.Net
Code
C#
private void btnSend_Click(object sender, EventArgs e)
{
string mobile = "Way2SMSMobileNo";
string password = "Way2SMSPassword";
string text = txtMessage.Text;
string number = txtPhoneno.Text;
string key = "API_Key";
string url = "https://smsapi.engineeringtgr.com/send/?Mobile=" + mobile + "&Password=" + password + "&Message=" + text + "&To=" + number + "&Key=" + key;
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
ServicePointManager.DefaultConnectionLimit = 9999;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";
request.ContentType = "application/json";
request.ContentLength = 0;
try
{
WebResponse webResponse = request.GetResponse();
Stream webStream = webResponse.GetResponseStream();
StreamReader responseReader = new StreamReader(webStream);
string response = responseReader.ReadToEnd();
responseReader.Close();
}
catch (Exception ex)
{
}
}
VB.Net
Private Sub btnSend_Click(sender As System.Object, e As System.EventArgs) Handles btnSend.Click
Dim mobile As String = "Way2SMSMobileNo"
Dim password As String = "Way2SMSPassword"
Dim text As String = txtMessage.Text
Dim number As String = txtPhoneno.Text
Dim key As String = "API_Key"
Dim url As String = "https://smsapi.engineeringtgr.com/send/?Mobile=" & mobile & "&Password=" & password & "&Message=" & text & "&To=" & number & "&Key=" & key
ServicePointManager.Expect100Continue = True
ServicePointManager.SecurityProtocol = CType(3072, SecurityProtocolType)
ServicePointManager.DefaultConnectionLimit = 9999
Dim request As HttpWebRequest = CType(WebRequest.Create(url), HttpWebRequest)
request.Method = "GET"
request.ContentType = "application/json"
request.ContentLength = 0
Try
Dim webResponse As WebResponse = request.GetResponse()
Dim webStream As Stream = webResponse.GetResponseStream()
Dim responseReader As StreamReader = New StreamReader(webStream)
Dim response As String = responseReader.ReadToEnd()
responseReader.Close()
Catch ex As Exception
End Try
End Sub
Note: Here you need to provide the Mobile Number. So do it at your own risk.