在我的web applicatin中,我使用api发送短信,雅它工作正常单个电话号码,但我的要求是我想发送短信到两个电话号码(手机号码)可以帮助我。当用户来我的网站和注册autometically管理将得到短信提醒,现在我想同时发送短信。在asp.net中发送多个短信?
protected void btnSend_Click(object sender, EventArgs e)
{
try
{
mobile =Server.HtmlEncode (txtMobile.Text);
message = Server.HtmlEncode(txtMessage.Text);
username = Server.HtmlEncode(txtName.Text);
password = Server.HtmlEncode(txtPassword.Text);
domian = Server.HtmlEncode(txtDomain.Text);
string result = apicall("http://"+domian+"/pushsms.php?username="+username+"&password="+password+"&sender=&to="+mobile+"&message="+message);
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);
}
sentMail()
}
catch
{
}
}
公共无效已经寄出() { 字符串移动= “9701098107”; string message =“test”; string username =“xxx”; string password =“yyyy”; string domian =“smsftt.com”; string result1 = apicall(“http://”+ domian +“/pushsms.php?username=”+ username +“& password =”+ password +“& sender = & to =”+ mobile +“& message = “+留言); }
public string apicall(string url)
{
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";
}
}
如果数字存储在列表中那么您是否可以不仅仅调用列表中电话号码的单个发送例程? –
WestDiscGolf
2010-07-21 14:16:46
WestDiscGolf先生实际上,当有用户来到我的网站并自动注册时,管理员将获得短信提醒,现在我想同时向用户发送短信。我正在把代码请检查它。我编辑我的问题,请检查一次 – 2010-07-21 14:21:00