-
-
Save liujbo/ab35904faaa9c8eb77127bcd6025525d to your computer and use it in GitHub Desktop.
HTTP请求传入参数示例
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
maven依赖: | |
<dependency> | |
<groupId>org.apache.httpcomponents</groupId> | |
<artifactId>httpclient</artifactId> | |
<version>4.5.3</version> | |
</dependency> | |
List<NameValuePair> params = new ArrayList<NameValuePair>(); | |
params.add(new BasicNameValuePair("account", SmsConstant.SMS_USERNAME)); | |
params.add(new BasicNameValuePair("pswd",SmsConstant.SMS_PASSWORD)); | |
params.add(new BasicNameValuePair("mobile",mobile)); | |
params.add(new BasicNameValuePair("msg",message)); | |
params.add(new BasicNameValuePair("needstatus","false")); | |
//调用HttpUtil工具类 | |
String response = HttpUtil.doPost(SmsConstant.SMS_URL,params); | |
String [] responses = response.split(","); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment