URL模拟登陆出现的小问题(新手)
2017-03-15 23:28
155 查看
0x00
List<NameValuePair> params = new ArrayList<NameValuePair>();含义:
定义了一个list,该list的数据类型是NameValuePair(简单名称值对节点类型),这个代码多处用于Java像url发送Post请求。在发送post请求时用该list来存放参数。
发送请求的大致过程如下:
List<NameValuePair> params = new ArrayList<NameValuePair>();含义:
定义了一个list,该list的数据类型是NameValuePair(简单名称值对节点类型),这个代码多处用于Java像url发送Post请求。在发送post请求时用该list来存放参数。
发送请求的大致过程如下:
String url="http://www.baidu.com"; HttpPost httppost=new HttpPost(url); //建立HttpPost对象 List<NameValuePair> params=new ArrayList<NameValuePair>(); //建立一个NameValuePair数组,用于存储欲传送的参数 params.add(new BasicNameValuePair("pwd","2544")); //添加参数 httppost.setEntity(new UrlEncodedFormEntity(params,HTTP.UTF_8)); //设置编码 HttpResponse response=new DefaultHttpClient().execute(httppost); //发送Post,并返回一个HttpResponse对象
相关文章推荐
- 用selenium模拟登陆知乎账号,处理登陆界面随机出现验证码窗口的问题
- 模拟登陆微信设置url和token,出现{"ret":"-104", "msg":"check args error"}
- wampserver登陆mysql出现#1045 - Access denied for user 'root'@'localhost' (using password: YES) 问题
- Java 调用 FFMPEG 命令时用 url 作为输入源,Linux 下出现 “no such file or directory” 问题的解决
- httpclient模拟登陆,不支持https的问题
- AngularJS中get请求URL出现跨域问题
- Android初学者首次真机模拟adb出现问题解决方法:
- CAS单点登陆,URL多出个参数jsessionid导致登陆失败问题
- url传中文在IE中出现乱码问题处理
- HttpURLConnection写的模拟登陆
- 如何利用已有的cook模拟登陆知乎,并爬取相关问题下所有的答案
- 新手使用 Nexus 出现的问题 (400-bad request missing request entity)
- 模拟JQuery的Ready方法实现并出现的问题
- httpclient模拟登陆微博问题
- thinkphp 下url模式为伪静态的情况下翻页出现问题的解决方式。
- 在论坛中出现的比较难的sql问题:45(用户在线登陆时间的小时、分钟计算问题)
- 帝国cms后台登陆出现空白页的问题所在及解决方法
- 通过URL传参数到后台出现乱码问题
- 73.iOS UIWebView重定向问题处理 RNCachingURLProtocol做缓存出现的重定向问题
- 初学者使用hibernate连接MySQL出现unable to create connection check your url问题