Simple implementation of SMS--c# version

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.