调用短信接口
/// <summary> ////// </summary> /// <param name="phone">手机号码</param> /// <param name="content">短信内容</param> /// <param name="UserID">账号</param> /// <param name="PassWord">密码</param> /// <param name="result">返回值</param> /// <returns>1则成功</returns> private static string SendMsgByRuiHua(string phone, string content, string UserID, string PassWord, ref string result) { string contents = System.Web.HttpUtility.UrlEncode(content, System.Text.Encoding.GetEncoding("gbk")); string strSend = "http://183.60.176.8:8080/Message.sv?method=sendMsg&userCode=" + UserID + "&userPwd=" + PassWord + "&numbers=" + phone + "&msgContent=" + contents + "&charset=gbk"; WebRequest webRequest = WebRequest.Create(strSend); WebResponse respone = webRequest.GetResponse(); Stream stream = respone.GetResponseStream(); StreamReader reader = new StreamReader(stream, System.Text.Encoding.Default); string num = reader.ReadToEnd(); respone.Close(); string[] resultNum = num.ToString().Trim().Split(','); int firstNum = Convert.ToInt32(resultNum[0]) > 0 ? Convert.ToInt32(resultNum[0]) : -1; if(firstNum > 0) { result = "{success:true}"; } else { result = "{success:false}"; } return result; }