| | |
| | | package com.project.common.sms; |
| | | |
| | | import com.project.common.constant.Constants; |
| | | import com.project.common.utils.SslUtils; |
| | | import org.apache.http.HttpEntity; |
| | | import org.apache.http.NameValuePair; |
| | | import org.apache.http.client.entity.UrlEncodedFormEntity; |
| | | import org.apache.http.client.methods.CloseableHttpResponse; |
| | | import org.apache.http.client.methods.HttpPost; |
| | | import org.apache.http.impl.client.CloseableHttpClient; |
| | | import org.apache.http.impl.client.HttpClients; |
| | | import org.apache.http.message.BasicNameValuePair; |
| | | import org.apache.http.util.EntityUtils; |
| | | |
| | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static com.project.common.utils.WxPayUtils.createIgnoreSSLHttpClient; |
| | | |
| | | /** |
| | | * 短信http接口的java代码调用示例 |
| | |
| | | */ |
| | | public static String post(String url, Map<String, String> paramsMap) |
| | | { |
| | | CloseableHttpClient client = HttpClients.createDefault(); |
| | | CloseableHttpClient client = createIgnoreSSLHttpClient(); |
| | | |
| | | String responseText = ""; |
| | | CloseableHttpResponse response = null; |
| | | try { |
| | | |
| | | HttpPost method = new HttpPost(url); |
| | | if(method.getURI().getPath().contains("https")){ |
| | | SslUtils.ignoreSsl(); |
| | | } |
| | | if (paramsMap != null) { |
| | | List<NameValuePair> paramList = new ArrayList<NameValuePair>(); |
| | | for (Map.Entry<String, String> param : paramsMap.entrySet()) { |