Java implementation to send SMS verification function

Source: Internet
Author: User

Now basic every website or app user Registration page has added SMS verification function, add SMS verification function, can effectively avoid illegal registration and bad registration situation, and access to the user's effective contact, then how to achieve the mobile phone message verification function? The following is a Java development language as an example, in detail for you to introduce.

first, the realization of mobile phone message verification function of the basic ideas are as follows:

1, first find a reliable SMS authentication Code interface service provider, get SMS verification code call address, and related access documents. It is strongly recommended that you choose the power of mind Letter SMS Authentication Code Interface service providers, a professional to provide SMS application services for 14 years of enterprise;

2, in the Site Information submission page request to send information;

3. The server submits the request to the dynamic Thinking music message interface platform;

4, dynamic Thinking Music letter interface platform through the three major operators to send verification code content to the user's phone.

Second, mobile phone number SMS verification foreground page effect implementation


  <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" > 

Third, call the interface method in the Yanzhengma.do method

      /** * Call SMS Server SMS interface * @param accname account username * @param accpwd Credit Account password * @param seed current time format: YYYYMMDD Hhmiss Example: 201308061 02030 * @param aimcodes Mobile phone number of multiple mobile phone numbers separated by commas * @param content contents after signing * @param schtime timing time format such as: 2010-01-01 08:00:00 * @return Results returned by the server OK: Business ID or error code */public static string sendsms (String accname,string accpwd,string mobies,string content,string s Chtime) {StringBuffer sb = new StringBuffer ("Http://sdk.lx198.com/sdk/send2?"); try {String seed=new SimpleDateFormat (DATEFORMATSTR). Format (new Date ()); Sb.append ("&accname=" +accname); Sb.append ("&seed=" +seed); Sb.append ("&accpwd=" +md5.getmd5string (md5.getmd5string (ACCPWD) +seed)); Sb.append ("&aimcodes=" +mobies); Sb.append ("&schtime=" +urlencoder.encode (Schtime, "UTF-8")); Space punctuation marks do encode conversion sb.append ("&content=" +urlencoder.encode (Content, "UTF-8")); Chinese do encode convert url url = new URL (sb.tostring ()); HttpURLConnection connection = (httpurlconnection) url.openconnection (); Connection.setrequestmethod ("POST"); BufferedreadEr in = new BufferedReader (New InputStreamReader (Url.openstream ())); return In.readline ();} catch (Exception e) {e.printstacktrace ();} return null;}
iv. Verification of SMS verification code when submitting form information

Phone Verification Code Start

Session_Start ();  $svalitel = $_session[' Mobilecode '); $vdcodetel = Empty ($vdcodetel)?    ": Strtolower (Trim ($vdcodetel));  if (Strtolower ($vdcodetel)! = $svalitel | | $svalitel = = ") {Resetvdvalue ();  echo "pageviews=". $vdcodetel; ShowMsg ("Phone Verification code Error!  ", '-1 ');  Exit (); }
Related reading:

Happy Letter SMS Authentication Interface Access Guide: http://www.lx598.com/jrzn.html

SMS Authentication Interface API Documentation: http://www.lx598.com/apitext.html

LG SMS Authentication Interface Java demo:http://www.lx598.com/javacode.html

Java implementation to send SMS verification function

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.