The simple implementation of text messaging--c# version

Source: Internet
Author: User
In order to verify the identity of the operator, the interface usually has the ability to obtain the authentication code. and click to get the verification code will be sent to the phone number you enter a message to verify.

Recently, the company has also included this function in my task, so let me explain next.

------------------

To use this function is to spend money, someone to provide you with the account and password and then call the interface implementation.

Plainly this piece of knowledge is the introduction of the call SMS interface.

Less nonsense, directly on the code:

String posurl = "Http://139.129.107.247/sms/xml/send?username=" + username + "&password=" + UserPassword + "&mobi Le= "+ 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 = new StreamReader (stream, encode);
            string result = Reader. ReadToEnd (); >0 success, SMS batch number 1971           
            Long issuccess = Convert.toint64 (result),//issuccess>0 send success
            if (issuccess > 0)// Return 1 proof send successful return 0 proof send failed!
            {Context               
                . Response.Write ("1");               
            }
            else
            {context              
                . Response.Write ("0");             
            }
View Code

Introduction of several parameters:

String UserName = "";//user

String userpassword = "";//user password
String msgcontent = "Send SMS test content";

--------------------------------------------------

By calling the above code, you can send a text message ~

Enterprise SMS landing site: http://sms.ydqxt.com

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.