Enter Aliyun Market Page: After login, select API.
Select the SMS interface item I need on the API service page and click Enter
Choose the eye-to-eye interface service.
If it's a trial, choose 0 yuan/5 times. If you have money and don't worry about spending, choose 30,000 yuan/100,000 times to buy.
After payment is completed, click on the Admin Console.
The console has some parameters of the service just purchased, the most important of which is appcode, which is an important parameter that has been purchased. It is used to send parameters in the code, and to reduce the number of times accordingly.
Return to view the interface code.
Copy the main method of the corresponding language provided on the page.
Create a cloud toolkit that corresponds to utils of the api interface
Create the corresponding java class
Copy the code for HttpUtils.
Add the corresponding dependencies,
<dependencies> <!-- <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-transports-http-hc</artifactId> <version>3.1.10</version> </dependency> --> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.15</version> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>4.2.1</version> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpcore</artifactId> <version>4.2.1</version> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.6</version> </dependency> <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-util</artifactId> <version>9.3.7.v20160115</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.5</version> <scope>test</scope> </dependency> </dependencies>
Ctrl+shirt+o automatic package, httpUtils automatic package, no error reporting.
Fine-tune the code of main method to modify the value of appcode
The management center has the appcode generated after purchase, just replace it.
It can be used to send the location of parameters, such as sending authentication codes.
When the configuration is complete, start the main method and return the resultType that executed successfully.
Short message received by mobile phone: