try
{
string key = "d41d8cd98f00b204e980";//网站提供的Key
string mobileNum = "xxxxxxxxxx";//发送对象的电话号码
string UID = "xxx";//短信发送平台账号的ID
Random rd = new Random();
int num = rd.Next(100000,1000000);//生成六位随机数
string Text = string.Format("验证码为:{0}打断腿都不能告诉别人。",num);
string URL = string.Format("http://utf8.api.smschinese.cn/?Uid={0}&Key={1}&smsMob={2}&smsText= {3}",UID,key,mobileNum,Text);//网站提供的接口,输入参数即可
HttpWebRequest hr = (HttpWebRequest)WebRequest.Create(URL);
hr.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
hr.Method = "GET";
hr.Timeout = 30 * 60 * 1000;
WebResponse hs = hr.GetResponse();
Stream sr = hs.GetResponseStream();
StreamReader ser = new StreamReader(sr, Encoding.Default);
var strRet = ser.ReadToEnd();
}
catch (Exception)
{
}
{
string key = "d41d8cd98f00b204e980";//网站提供的Key
string mobileNum = "xxxxxxxxxx";//发送对象的电话号码
string UID = "xxx";//短信发送平台账号的ID
Random rd = new Random();
int num = rd.Next(100000,1000000);//生成六位随机数
string Text = string.Format("验证码为:{0}打断腿都不能告诉别人。",num);
string URL = string.Format("http://utf8.api.smschinese.cn/?Uid={0}&Key={1}&smsMob={2}&smsText= {3}",UID,key,mobileNum,Text);//网站提供的接口,输入参数即可
HttpWebRequest hr = (HttpWebRequest)WebRequest.Create(URL);
hr.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
hr.Method = "GET";
hr.Timeout = 30 * 60 * 1000;
WebResponse hs = hr.GetResponse();
Stream sr = hs.GetResponseStream();
StreamReader ser = new StreamReader(sr, Encoding.Default);
var strRet = ser.ReadToEnd();
}
catch (Exception)
{
}