我正在从构建在 ASP.NET C# 中的 Web 应用程序发送短信,但由于某种原因,当我添加工作时SourceAddress
,它会通过.parameter.Add("SourceAddress", "BPD.co.uk");
BPD.co.uk
BPDcouk
我怎样才能使积分出现?
这是我的 C# 代码:
public void SendSms(string MobileNumber, string SMSContent)
{
Dictionary<string, string> parameter = new Dictionary<string, string>();
parameter.Add("Action", "Send");
parameter.Add("DestinationAddress", MobileNumber);
parameter.Add("SourceAddress", "BPD.co.uk");
parameter.Add("Body", SMSContent);
parameter.Add("ValidityPeriod", "86400");
string resultcode = api_connect("nsp04456", "pword", parameter);
}
这是对 API_Connect 的调用
private string api_connect(string Username, string Password, Dictionary<string, string> ParametersDict)
{
string url = "http://api.sms.co.uk/api/api.php";
string poststring = "Username=" + Username + "&";
poststring = poststring + "Password=" + Password;
// Turn the parameter dictionary object into the variables
foreach (KeyValuePair<string, string> item in ParametersDict)
{
poststring = poststring + "&" + item.Key + "=" + item.Value;
}
MSXML2.ServerXMLHTTP60 xmlHttp = new MSXML2.ServerXMLHTTP60();// Server.CreateObject("MSXML2.ServerXMLHTTP.4.0");
xmlHttp.open("POST", url, false);
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlHttp.send(poststring);
return xmlHttp.responseText;
}