Translate

Monday, 4 September 2017

send sms in c# , send sms in button click

  use this namespace

       using System.IO;
        using System.Net;

use this code in code behind

 protected void btnSendSMS_Click(object sender, EventArgs e)
        {
            SendSMS();

        }




        public void SendSMS()
        {
            string sURL;
            StreamReader objReader;
            //give the USERNAME,PASSWORD,moblienumbers.... on URL
            string userName = "xxxxxx";
            string password = "xxxx";
            string no1 = "xxxxxx";
            string senderid = "xxxx";
            string msgText = "hello SMS";
            sURL = "http://sandeshlive.in/API/WebSMS/Http/v1.0a/index.php?username=" + userName + "&password=" + password + "&sender=" + senderid + "&to=" + no1 + "&message=" + msgText + "&reqid=1&format=json&route_id=23";
            WebRequest wrGETURL;
            wrGETURL = WebRequest.Create(sURL);
            try
            {
                wrGETURL.Timeout = 999999999;
                Stream objStream;
                objStream = wrGETURL.GetResponse().GetResponseStream();
                objReader = new StreamReader(objStream);
                Response.Write(objReader.ReadToEnd());
                objReader.Close();
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
        }

1 comment:

  1. Thanks for sharing this blog. We have now started providing bulk SMS API C# India that is very powerful and easy to integrate into your own software/application/website. As it saves your lot of valuable time in logging our interface again and again.

    ReplyDelete