在我的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