In the program that sends the text message, we add using System.Net in the code editing area, namespace.
private string url = "http://utf8.sms.webchinese.cn/"; //private string URL = "HTTP +/ Utf8.sms.webchinese.cn/? uid=xiaokai&key=&smsmob= mobile phone number &smstext= SMS content "; private string strUid = "Uid="; //private string strkey = "&key=8df38a399aa3bb8f632f"; private string strKey = "&key="; private string strmob = "&smsmob="; private string strcontent = "&smstext="; /// <summary> /// Mass Message /// </summary> /// <param name= "url" > /// given an explicit address (including phone, username, secret key) /// < /param> /// <returns> The /// return value is used to determine whether the send succeeded /// </ Returns> public string gethtmlfromurl (string URL) { string strRet = null; if (url == null | | url. Trim (). ToString () == "") { return strret; } string targeturl = url. Trim (). ToString (); try { HttpWebRequest hr = (HttpWebRequest) WebRequest.Create ( TargetUrl); 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); strret = ser. ReadToEnd (); } catch (Exception ex) { strret = null; messagebox.show (ex. Message); } return strRet; } /// <summary> /// Send SMS /// </summary> /// <param name= "Sender" ></param> /// <param name= "E" ></param> private void btn_send_click (object sender, eventargs e) { if (Txt_ Username. Text.tostring (). Trim () != "" && textbox4.text.tostring (). Trim () != " && textbox2.text.tostring () != null) { url = url + struid + txt_username. Text + strkey + txt_key. text + strmob + textbox4.text + strcontent + textbox2.text; string result = gethtmlfromurl (URL); messagebox.show (Result); &nBSP;} else { messagebox.show ("Please fill in complete, do not empty!") "); } }
The above process of sending SMS is used by the API provided by China Network. Refer to the following:
China network construction, SMS mass platform
C # Mass SMS