HELP ON SENDING SMS IN C#

Posted by Vijayar under ASP.NET on 1/27/2012 | Points: 10 | Views : 1390 | Status : [Member] | Replies : 3
Hi
I have 2 fields called class,message.I am using listbox to bind all class names so that i can select more than one class,based on the classes id i am selecting,i am fetching their parent mobile numbers and sending sms to them.Now i want a free webservice to send an sms to test the form.Please help me with the required code.I want the way to send this by using free webservice which accepts only phone number,message as arguments.No other fields

vijaya


Responses

Posted by: Rkworlds on: 1/27/2012 [Member] Starter | Points: 25

Up
0
Down
http://www.codeproject.com/Articles/20064/How-to-Send-SMS-Messages-from-C-using-an-SQL-Datab

If this helps you .
Please "Mark as Answer"

Vijayar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rkworlds on: 1/27/2012 [Member] Starter | Points: 25

Up
0
Down
Using API

http://www.ozekisms.com/index.php?owpn=315

If this helps you .
Please "Mark as Answer"

Vijayar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nsatija on: 2/1/2012 [Member] Starter | Points: 25

Up
0
Down
1. Create a new page called Demo.aspx
2. In the codebehind file demo.aspx.vb copy paste the following code
Imports System.Net  

Imports System.IO

Partial Class demo
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
SendSMS("18479790553", "ToNumber", "Do Not Reply: You have an appointment on 1-20-2012 at 3:00pm with Dr. McAndrews at the Carson Office. Please arrive 15 minutes early. ")
End Sub

Sub SendSMS(ByVal FromNumber As String, ByVal ToNumber As String, ByVal SMS As String)
Response.ContentType = "text/xml; charset=utf-8"
Dim url As String = "https://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")
request.ContentLength = byteArray.Length
Dim dataStream As Stream = request.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length)
dataStream.Close()
Dim _webresponse As WebResponse = request.GetResponse()
dataStream = _webresponse.GetResponseStream()
Dim reader As New StreamReader(dataStream)
Dim responseFromServer As String = reader.ReadToEnd()
Response.Write(responseFromServer)
reader.Close()
dataStream.Close()
'Response.Close()
End Sub
End Class


Nick S

Vijayar, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response