In order to verify the identity of the operator, the interface usually has the ability to obtain a verification code. and click to get the verification code will be sent to your mobile phone number to send a message to verify.
Recently the company gave me the task of including this function, then let me explain next.
------------------
To use this function is to spend money, people give you an account and password and then invoke the interface implementation.
Plainly this piece of knowledge is the introduction of the call SMS interface.
Say less nonsense, directly on the code:
stringPosurl ="http://139.129.107.247/sms/xml/send?username="+ UserName +"&password="+ UserPassword +"&mobile="+ Telphone +"&message="+ Httputility.urlencode (msgcontent, System.Text.Encoding.GetEncoding ("Utf-8")); WebRequest Request=WebRequest.Create (@posurl); WebResponse response=request. GetResponse (); Stream Stream=Response. GetResponseStream (); Encoding encode=Encoding.UTF8; StreamReader Reader=NewStreamReader (stream, encode); stringresult = reader. ReadToEnd ();//>0 Success, SMS batch number 1971 LongIssuccess = Convert.toint64 (result);//Issuccess>0 is sent successfully if(Issuccess >0)//return 1 proof sent successfully return 0 proof send failed!{context. Response.Write ("1"); } Else{context. Response.Write ("0"); }View Code
Several parameters are described:
String UserName = "";//user
String userpassword = "";//user password
String msgcontent = "Send SMS test content";
--------------------------------------------------
By calling the above code, you can send a text message ~
Simple implementation of SMS--c# version