Send sms using API and sms gateway
Posted Date Unknown 0 Comment

Introduction
To send SMS from website for any application, you have to purchase sms credits from any sms provider and It is very simple to do this through your application . Now a days TRAI has been made some restrictions for sending SMS in india .
Description
To send sms we have to use api http request  .before doing that we should have enough sms credit in your account  with a registered account with any sms service provider .

C# Sample Code

public string apicall(string url)  // API Push
    {
        HttpWebRequest httpreq = (HttpWebRequest)WebRequest.Create(url);
        try
        {
            HttpWebResponse httpres = (HttpWebResponse)httpreq.GetResponse();
            StreamReader sr = new StreamReader(httpres.GetResponseStream());
            string results = sr.ReadToEnd();
            sr.Close();
            return results;

        }
        catch
        {
            return "0";
        }
    }


public void SendSMS()
    {

        try
        {     
            mobile = "to number";
            message2 = "Your sms here '";
            username = "your user name";
            password = "your pwd";
            domian = "sms.scibero.com";
            senderid = "sender";
            string result = apicall("http://" + domian + "/pushsms.php?username=" + username + "&password=" + password + "&sender=" + senderid + "&to=" + mobile + "&message=" + message2);
            if (!result.StartsWith("Wrong Username or Password"))
            {
                //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "alert('Message Sent')", true);
            }
            else
            {
               // ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "alert('Message Sending Failed')", true);
            }

        }
        catch
        {
        }
    }

See All Responses Below...
Author
Message Rating
Posted on:
Please Login to Post Your Comments
Name (Max. 100 characters)
Please post your comments here
Select Language
Comments
Attach File(Max. Size: 2 MB)
A few simple rules when posting your Comments,
  1. Please post only answers relevant to the topic of discussion.
  2. Please dont misuse this site or do not be abusive, offensive, inappropriate,harass anyone on the boards or post ads or spam. Doing so will delete your inappropriate messages and will block or delete your account on this site. 

TekTipsDownload
GateExam
Academic Projects
TekTipsExperts



 
Site optimized for IE7, 1280 X 768 and above. Copyright © 2010 - 2018 KTS InfoTech
Site Developed Using KTS WebCloud