Search This Blog

Thursday, December 16, 2010

WebRequest for sending SMS By GET METHOD

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Net;
using System.Web.Security;
using System.Web.UI.HtmlControls;


public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SendSms();

}
protected void SendSms()
{
try
{

string userid1 = "test&";
string pass1 = "test&";
string appid1 = "test&";
string subappid1 = "test&";
string contenttype1 = "1&";
string selfid1 = "true&";
string from1 = "test&";
string to1 = "9911964567&";
string text1 = "thanks for visit our site&";
string dlrreq1 = "true&";
string alert1 = "1";
string url = "http://sms gateway url?";
string str_request = "userId=" + userid1 + "pass=" + pass1 + "appid=" + appid1 + "subappid=" + subappid1 + "contenttype=" + contenttype1 + "selfid=" + selfid1 + "from=" + from1 + "to=" + to1 + "text=" + text1 + "dlrreq=" + dlrreq1 + "alert=" + alert1;
WebRequest request = WebRequest.Create(url + str_request);
request.Method = "GET";
request.ContentLength=str_request.Length;
request.ContentType="application/x-www-form-urlencoded";
using (WebResponse response = request.GetResponse())
{
using (Stream stream = response.GetResponseStream())
{
StreamReader sr = new StreamReader(stream);


}

}

No comments :