The mobile phone sends the verification code -.net and the verification code. net.

Source: Internet
Author: User

The mobile phone sends the verification code -.net and the verification code. net.

The verification code sent by SMS is as follows:

(1) The user submits a mobile phone number and applies for the verification code of the Lake District

(2) The website generates a verification code according to premade rules.

(3) The website sends the user's mobile phone number and verification code to the SMS Platform

(4). Send the specified content to the specified mobile phone number

(5) After receiving the verification code, the user submits the verification code.

(6). Judge and submit the form

The interface code is as follows:

<Span style = "font-size: 18px;"> try {Encoding myEncoding = Encoding. getEncoding ("UTF-8"); string param = "action = send & userid =" + userid + "& account =" + HttpUtility. urlEncode (account, myEncoding) + "& password =" + HttpUtility. urlEncode (password, myEncoding) + "& mobile = 13012317839,13210910291 & content =" + HttpUtility. urlEncode (content, myEncoding) + "& sendTime =" + HttpUtility. urlEncode (sendTime, myEncoding) + "& Mobilenumber = 2 & countnumber = 2 & telephonenumber = 0"; byte [] postBytes = Encoding. ASCII. getBytes (param); HttpWebRequest req = (HttpWebRequest) HttpWebRequest. create ("http://xtx.telhk.cn: 8888/sms. aspx "); req. method = "POST"; req. contentType = "application/x-www-form-urlencoded; charset = UTF-8"; req. contentLength = postBytes. length; using (Stream reqStream = req. getRequestStream () {reqStream. write (postBytes, 0, postBytes. length);} System. xml. xmlDocument xmlDoc = new System. xml. xmlDocument (); using (WebResponse wr = req. getResponse () {StreamReader sr = new StreamReader (wr. getResponseStream (), System. text. encoding. UTF8); System. IO. streamReader xmlStreamReader = sr; xmlDoc. load (xmlStreamReader);} if (xmlDoc = null) {MessageBox. show ("request exception");} else {String message = xmlDoc. getElementsByTagName ("message "). it Em (0 ). innerText. toString (); if (message = "OK") {MessageBox. show ("sent successfully");} else {MessageBox. show (message) ;}} catch (System. net. webException WebExcp) {MessageBox. show ("network error, unable to connect to the server! ") ;}</Span>
Here, userid is the enterprise id, account is the sending user account, and password is the sending account password, all of which are from the SMS interface operator

Content is the content to be sent, and sendTime is the timed sending. If it is null, it means to send the action immediately. The Task Command checkcontent is used to check whether the content contains the illegal keyword taskName is the task name, and the total count of countnumber, mobilenumber indicates the number and telephonenumber indicates the number of PHS or landline numbers.

The task of sending short messages is implemented through the short message interface of the SMS operator. In the content, set the content to be sent, usually the verification code. After the message is sent successfully, the sent verification code is stored in the database or stored in the session for the user to submit the message, to determine whether the verification code is correct. All functions can be implemented only after the judgment is passed.

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.