在我的网络应用程序中,我使用的是发送短信的api,是的,这是一个很好的工作为单一的电话号码,但我的要求是我想发送短信到两个电话号码(手机号码)你可以帮助我。当用户来到我的网站并自动注册管理员将得到短信提醒,现在我想发送短信在同一时间。
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
{
}
}
{
string message=“测试”;
string username=“xxx”;
string domian=“smsftt.com”;
string result1=apicall(“http://“+domian+”/pushsms.php?username=“+username+”&password=“+password+”&发件人=&至=“+移动+”&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";
}
}