hi everyone
i am new this site
i am creating new sms application for desktop using way2sms account
please anyone help me to write the code
navachaitanya 0 Newbie Poster
Dani AI
Generated
A practical summary and next steps for : you can integrate SMS from a VB.NET desktop app three ways — use an official HTTP/REST SMS API, script the way2sms web UI (fragile), or use a hardware GSM modem with AT commands (what showed). Historically many people reverse‑engineered way2sms web calls or published small helpers, but those approaches break when the site changes and they may violate the service terms. (stackoverflow.com)
If reliability matters, register for a proper SMS API (provider examples below). They give stable HTTPS endpoints, keys, delivery reports and .NET support so you don’t parse HTML or deal with CAPTCHAs. Twilio has a well‑documented VB.NET workflow and SDK; Textlocal (India) exposes a simple form/JSON API you can call from HttpClient. For production use these are far less brittle than scraping way2sms pages. (twilio.com)
Quick VB.NET pattern (HttpClient + form POST) you can adapt to Textlocal/Twilio SDKs — replace values with your provider’s parameters and API key:
Imports System.Net.Http
Sub SendSms()
Dim client As New HttpClient()
Dim values = New Dictionary(Of String, String) From {
{"apikey", "YOUR_API_KEY"},
{"numbers", "9198xxxxxxxx"},
{"message", "Test from VB.NET"},
{"sender", "TXTLCL"}
}
Dim content = New FormUrlEncodedContent(values)
Dim resp = client.PostAsync("https://api.textlocal.in/send/", content).Result
Dim body = resp.Content.ReadAsStringAsync().Result
Console.WriteLine(body)
End Sub If you stick with a GSM modem (or try to keep ’s approach), make sure to read and parse the modem responses: issue AT+CMGF=1, send AT+CMGS="recipient" then wait for the prompt (>), send the message and terminate with Ctrl+Z. Don’t rely on a MessageBox to assume success — confirm the modem returns +CMGS and OK. Also expect rate limits, OTP/CAPTCHA on web portals, and legal/ToS limits when automating consumer sites. (docs.korewireless.com)
tendaimare 0 Junior Poster in Training
i think since you didn't have code at all this can be a good starting point and if this code is helpfull could u pliz vote
Imports System
Imports System.Threading
Imports System.ComponentModel
Imports System.IO.Ports
Public Class Form1
'connect your mobile/GSM modem to PC,
'then go in device manager and check under ports which COM port has been slected
'if say com1 is there then put com2 in following statement
Dim SMSEngine As New SMSCOMMS("COM7")
Dim i As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
SMSEngine.Open() 'open the port
SMSEngine.SendSMS() 'send the SMS
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
SMSEngine.Open() 'open the port
SMSEngine.ReadSMS() 'send the SMS
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
SMSEngine.Open() 'open the port
End Sub
End Class
Public Class SMSCOMMS
Private WithEvents SMSPort As SerialPort
Private SMSThread As Thread
Private ReadThread As Thread
Shared _Continue As Boolean = False
Shared _ContSMS As Boolean = False
Private _Wait As Boolean = False
Shared _ReadPort As Boolean = False
Public Event Sending(ByVal Done As Boolean)
Public Event DataReceived(ByVal Message As String)
Public Sub New(ByRef COMMPORT As String)
'initialize all values
SMSPort = New SerialPort
With SMSPort
.PortName = COMMPORT
.BaudRate = 115200
.Parity = Parity.None
.DataBits = 8
.StopBits = StopBits.One
.Handshake = Handshake.RequestToSend
.DtrEnable = True
.RtsEnable = True
.NewLine = vbCrLf
End With
End Sub
Public Function SendSMS() As Boolean
If SMSPort.IsOpen = True Then
'sending AT commands
SMSPort.WriteLine("AT")
SMSPort.WriteLine("AT+CMGF=1" & vbCrLf) 'set command message format to text mode(1)
SMSPort.WriteLine("AT+CSCA= ""+6596845999"" " & vbCrLf) 'set service center address (which varies for service providers (idea, airtel))
SMSPort.WriteLine("AT+CMGS= + TextBox1.text + " & vbCrLf) ' enter the mobile number whom you want to send the SMS
_ContSMS = False
SMSPort.WriteLine("+ TextBox1.text +" & vbCrLf & Chr(26)) 'SMS sending
MessageBox.Show("Successfully sent")
SMSPort.Close()
End If
End Function
Public Function ReadSMS() As Boolean
If SMSPort.IsOpen = True Then
'reading AT commands
SMSPort.WriteLine("AT")
SMSPort.WriteLine("AT+CMGF=1" & vbCrLf) 'set command message format to text mode(1)
SMSPort.WriteLine("AT+CMGL=ALL") 'set service center address (which varies for service providers (idea, airtel))
'SMSPort.WriteLine("AT+CMGS= + TextBox1.text + " & vbCrLf) ' enter the mobile number whom you want to send the SMS
'_ContSMS = False
'SMSPort.WriteLine("+ TextBox1.text +" & vbCrLf & Chr(26)) 'SMS sending
MessageBox.Show(":read")
SMSPort.Close()
End If
End Function
Public Sub Open()
If Not (SMSPort.IsOpen = True) Then
SMSPort.Open()
End If
End Sub
Public Sub Close()
If SMSPort.IsOpen = True Then
SMSPort.Close()
End If
End Sub
End Class navachaitanya 0 Newbie Poster
tajnil 0 Newbie Poster
hi if u solved it please give help how to do it.
shaik sarfraj 0 Newbie Poster
9550257211
John-Ghana 0 Newbie Poster
Please explain this portion of your code
Public Function ReadSMS() As Boolean
If SMSPort.IsOpen = True Then
'reading AT commands
SMSPort.WriteLine("AT")
SMSPort.WriteLine("AT+CMGF=1" & vbCrLf) 'set command message format to text mode(1)
SMSPort.WriteLine("AT+CMGL=ALL") 'set service center address (which varies for service providers (idea, airtel))
'SMSPort.WriteLine("AT+CMGS= + TextBox1.text + " & vbCrLf) ' enter the mobile number whom you want to send the SMS
'_ContSMS = False
'SMSPort.WriteLine("+ TextBox1.text +" & vbCrLf & Chr(26)) 'SMS sending
MessageBox.Show(":read")
SMSPort.Close()
End If
End Function
A msg displays as message sent but i dont seem to get where its being sent to
Edited by pritaeas because: Added markdown.
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.