The implementation is relatively simple. Just send the mobile phone number and content to a specific URL. The Code is as follows:
Public String sendsms (string mobile, string content) {string username = "Account"; // string Password = "password "; // provide the password string url = "http://utf8.sms.webchinese.cn"; // path string result = ""; int Re = 0; try {httpwebrequest request = (httpwebrequest) webrequest. create (URL); Request. method = "Post"; request. contenttype = "application/X-WWW-form-urlencoded"; stringbuilder buffer = new stringbuilder (); buff Er. appendformat ("uid = {0}", username); buffer. appendformat ("& Key = {0}", password); buffer. appendformat ("& smsmob = {0}", mobile); buffer. appendformat ("& smstext = {0}", httputility. urlencode (content + "[internal management system]", encoding. utf8); byte [] DATA = encoding. utf8.getbytes (buffer. tostring (); Using (Stream stream = request. getrequeststream () {stream. write (data, 0, Data. length);} httpwebresponse response = (HT Tpwebresponse) request. getresponse (); streamreader sr = new streamreader (response. getresponsestream (), encoding. utf8); string MSG = sr. readtoend (); Sr. close (); Int. tryparse (MSG, out re); If (Re <= 0) {result = "SMS sending failed! Error Code: "+ MSG;} else {result =" sms sent successfully ";}} catch (exception ex) {result =" SMS failed to be sent! Error message: "+ ex;} return result ;}