package com.ruoyi.study.utils;
|
|
/**
|
* 发送手机验证码工具类
|
*
|
* @author HJL
|
* @version 1.0
|
* @since 2024-05-17 14:31
|
*/
|
public class SendMsgUtils {
|
|
public static final String UID = "EUhello";
|
public static final String KEY = "6D05DE2FF1294C81CEF25E0862448D11";
|
|
public static String sendMessage(String smsMob, String smsText) {
|
// PostMethod post = new PostMethod("https://utf8api.smschinese.cn/");
|
// try {
|
// HttpClient client = new HttpClient();
|
// post.addRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");//在头文件中设置转码
|
// NameValuePair[] data = {new NameValuePair("Uid", UID), new NameValuePair("Key", KEY), new NameValuePair("smsMob", smsMob), new NameValuePair("smsText", smsText)};
|
// post.setRequestBody(data);
|
// client.executeMethod(post);
|
// Header[] headers = post.getResponseHeaders();
|
// int statusCode = post.getStatusCode();
|
// System.out.println("statusCode:" + statusCode); //HTTP状态码
|
//
|
// for (Header h : headers) {
|
// System.out.println(h.toString());
|
// }
|
// String result = new String(post.getResponseBodyAsString().getBytes("utf-8"));
|
// System.out.println(result); //打印返回消息状态
|
// return result;
|
// } catch (Exception e) {
|
// e.printStackTrace();
|
// } finally {
|
// // 关流
|
// post.releaseConnection();
|
// }
|
return null;
|
}
|
|
}
|