Fetch the repository succeeded.
This action will force synchronization from 山药蛋/HttpUtils, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
这是山药蛋的第一个开源项目,比较简单,如果有雷同不是巧合,欢迎拍砖。
如果你是一名web程序开发者,你一定拼过t=wxm2-login&lang=zh_CN&ajax=true这样的字符串吧。 例如:https://mp.weixin.qq.com/cgi-bin/loginpage?t=wxm2-login&lang=zh_CN。
Map<String, String> queryMap = new HashMap<String, String>();
queryMap.put("t", "wxm2-login");
queryMap.put("lang", "zh_CN");
queryMap.put("ajax", "true");
String query = ParamUtils.mapToQuery(queryMap);
query就是拼接好的t=wxm2-login&lang=zh_CN&ajax=true
String queryString = "t=wxm2-login&lang=zh_CN&ajax=true";
Map<String, String> queryMap = ParamUtils.queryToMap(queryString);
使用mapToQuery方法可以将t=wxm2-login&lang=zh_CN&ajax=true这样的QueryString转换为Map键值对
HttpRequest request = new HttpRequest();
String resultVal = request.addHeader("User-Agent", "Mozilla/5.0").addParam("username", "xxx@baidu.com").addParam("pwd", "123456").post("https://mp.weixin.qq.com/cgi-bin/login?lang=zh_CN");
或
HttpRequest request = new HttpRequest();
String resultVal = request.addHeader("User-Agent", "Mozilla/5.0").get("https://hao123.com");
链式调用方便快捷,一般场景中你只需要
String resultVal = new HttpRequest().get("https://hao123.com");
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。