Disclaimer: The materials used in this column are written by VIP students of Kaige Academy. Students have the right to remain anonymous and have the right to final interpretation of the article. Kaige Academy aims to promote VIP students to learn from each other based on public notes.
SMS verification code
SMS verification codes are all calling some interfaces to send SMS messages. SMS verification codes are most widely used in operations such as login and registration. This section of this article demonstrates how to use Java to create a simple SMS verification code login.
What I am demonstrating here is the SMS interface of aggregated data (not advertisement), because the interface call of aggregated data is more convenient and simple, so first of all, we must first apply for a SMS interface API in aggregated data:
You will be required to perform real-name authentication when applying. If you do not want to be authenticated, you can skip the authentication.
After applying for the SMS API, enter the following interface and click "Template":
You need to apply for a SMS template first, and define the template content according to your own needs (read the template rules at the bottom of this page before defining):
After submitting for review, you can see the template list and template review status at the bottom of this page:
Then click "My Data", and then click "Interface" in the SMS API service:
The calling instructions of the interface are all on this page, and the API needs to be called according to the rules here:
After the SMS template is applied, you can use this API. The following shows how to use Java to call this API and make a simple SMS verification code login: First, the index.jsp code of the page:
The class used to call the SMS interface:
Servlet that handles sending captcha requests:
Finally, the Servlet that handles the login business:
operation result:
Received verification code:
Enter the verification code to log in:
Console prints: