Click here to Skip to main content
12,066,952 members (55,921 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: VB VB.NET
anyone can help me to make sms gateway application using vb.net (desktop application).....?

please help me.....
Posted 26-Jan-12 2:52am
Edited 1-Feb-12 0:15am
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

It's a frequent question here in CP, so browse here SMS related questions/answers - Codeproject Search[^]

You can find many articles & past questions with multiple answers, Enjoy.
  Permalink  
Comments
Espen Harlinn 26-Jan-12 11:01am
   
5'ed!
Rajesh Anuhya 1-Feb-12 5:18am
   
+5 for CP, not for Raja ;-)
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Imports System.Net
Imports System.Text
Imports System.IO
 
Module Module1
 
    Sub Main()
 
        SendSMS("18479790553", "ToNumber", "I am coming there")
 
    End Sub
    Sub SendSMS(ByVal FromNumber As String, ByVal ToNumber As String, ByVal SMS As String)
 
        Dim url As String = "http://www.sendandreceivesms.com/api/"
        Dim request As HttpWebRequest = DirectCast(WebRequest.Create(url), HttpWebRequest)
        request.Method = "POST"
        Dim postData As String = "FromNumber=" & FromNumber
        postData += "&"
        postData += "ToNumber=" & ToNumber
        postData += "&"
        postData += "SMS=" & SMS
        Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData)
        request.ContentType = "application/x-www-form-urlencoded"
        request.Headers.Add("APIToken", "GoOu9H0h9G")'get your new API token at https://www.sendandreceivesms.com
        request.ContentLength = byteArray.Length
        Dim dataStream As Stream = request.GetRequestStream()
        dataStream.Write(byteArray, 0, byteArray.Length)
        dataStream.Close()
        Dim response As WebResponse = request.GetResponse()
        dataStream = response.GetResponseStream()
        Dim reader As New StreamReader(dataStream)
        Dim responseFromServer As String = reader.ReadToEnd() 'Log This in DB, Queue msgs that failed so that they can be sent again when console app runs
        reader.Close()
        dataStream.Close()
        response.Close()
    End Sub
 
End Module
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

Imports System.Data
Imports System.IO
Imports System.Configuration
Imports System
Imports System.Net
Imports System.Text

Public Function SendSMS(ByVal User As String, ByVal password As String, ByVal Mobile_Number As String, ByVal Message As String, Optional ByVal MType As String = "N") As String
Dim stringpost As String = "User=" & User & "&passwd=" & password & "&mobilenumber=" & Mobile_Number & "&message=" & Message & "&MTYPE=" & MType
'Response.Write(stringpost)
Dim functionReturnValue As String = Nothing
functionReturnValue = ""

Dim objWebRequest As HttpWebRequest = Nothing
Dim objWebResponse As HttpWebResponse = Nothing
Dim objStreamWriter As StreamWriter = Nothing
Dim objStreamReader As StreamReader = Nothing

Try
Dim stringResult As String = Nothing

objWebRequest = DirectCast(WebRequest.Create("http://Domain name/WebserviceSMS.aspx"), HttpWebRequest)
//domain name: Domain name Replace With Your Domain
objWebRequest.Method = "POST"

' Response.Write(objWebRequest)

' Use below code if you want to SETUP PROXY.
'Parameters to pass: 1. ProxyAddress 2. Port
'You can find both the parameters in Connection settings of your internet explorer.

' If you are in the proxy then Uncomment below lines and enter IP and Port.
' Dim myProxy As New Net.WebProxy("192.168.1.108", 6666)
'myProxy.BypassProxyOnLocal = True
'objWebRequest.Proxy = myProxy

objWebRequest.ContentType = "application/x-www-form-urlencoded"

objStreamWriter = New StreamWriter(objWebRequest.GetRequestStream())
objStreamWriter.Write(stringpost)
objStreamWriter.Flush()
objStreamWriter.Close()

objWebResponse = DirectCast(objWebRequest.GetResponse(),HttpWebResponse)


objWebResponse = DirectCast(objWebRequest.GetResponse(), HttpWebResponse)

objStreamReader = New StreamReader(objWebResponse.GetResponseStream())
stringResult = objStreamReader.ReadToEnd()
objStreamReader.Close()
Return (stringResult)
Catch ex As Exception
Return (ex.ToString)
Finally

If (objStreamWriter IsNot Nothing) Then
objStreamWriter.Close()
End If
If (objStreamReader IsNot Nothing) Then
objStreamReader.Close()
End If
objWebRequest = Nothing
objWebResponse = Nothing

End Try
End Function

Protected Sub btnsubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnsubmit.Click
Dim str As String
str = SendSMS(Trim(User1.Value), Passwd.Value, mobilenumber.Value, message.Value)
Response.Write(str)
End Sub
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

Anyone can help me ,I want to make SMS gateway Server (using GSMModem) and its for my school. And I want my App be E-Controlling Software. Smile | :) (I'm sorry my English is bad)
  Permalink  
Comments
CHill60 4-Mar-15 11:10am
   
If you have a question then use the "Ask a Question" link - don't post questions as solutions to old answers - few people will see it.
However, this is a Quick answers forum so you will have to try something for yourself before posting a question. Use a search engine to do some research and give it a try first... there are plenty of resources here on CodeProject if you type SMS into the search box!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web04 | 2.8.160208.1 | Last Updated 4 Mar 2015
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100