Sunday, 6 May 2012

how to send sms through way2sms using asp.net

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;

public partial class Default4 : System.Web.UI.Page
{
    string uid, password, message, no;
    protected void Page_Load(object sender, EventArgs e)
    {
        uid = "Enter ur way to sms register phone number(9040175532)";
        password = "way to sms password(ABC123)";
        message = "i want to meet u";
        no = "Sender phone number(9861077972)";
        HttpWebRequest myReq =
       (HttpWebRequest)WebRequest.Create("http://ubaid.tk/sms/sms.aspx?uid=" + uid + "&pwd=" + password +
       "&msg=" + message + "&phone=" + no + "&provider=way2sms");

        HttpWebResponse myResp = (HttpWebResponse)myReq.GetResponse();
        System.IO.StreamReader respStreamReader = new System.IO.StreamReader(myResp.GetResponseStream());
        string responseString = respStreamReader.ReadToEnd();
        respStreamReader.Close();
        myResp.Close();
        Response.Write("Message send sucessfully.");
    }
}

No comments:

Post a Comment