安卓java模拟器下载post提交问题

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
您的访问请求被拒绝 403 Forbidden - ITeye技术社区
您的访问请求被拒绝
亲爱的会员,您的IP地址所在网段被ITeye拒绝服务,这可能是以下两种情况导致:
一、您所在的网段内有网络爬虫大量抓取ITeye网页,为保证其他人流畅的访问ITeye,该网段被ITeye拒绝
二、您通过某个代理服务器访问ITeye网站,该代理服务器被网络爬虫利用,大量抓取ITeye网页
请您点击按钮解除封锁&import&java.util.Rimport&java.util.ArrayLimport&java.util.Limport&org.apache.http.HttpEimport&org.apache.http.HttpRimport&org.apache.http.NameValuePimport&org.apache.http.client.entity.UrlEncodedFormEimport&org.apache.http.client.methods.HttpGimport&org.apache.http.client.methods.HttpPimport&org.apache.http.cookie.Cimport&org.apache.http.impl.client.DefaultHttpCimport&org.apache.http.message.BasicNameValuePimport&org.apache.http.protocol.HTTP;import&org.apache.http.util.EntityU/**&*//**&*&Example&how&to&use&multipart/form&encoded&POST&request.&*/public&class&ClientMultipartFormPost&{&&&&public&static&void&ExecuClient(String&userName,&String&wlanuserip2,&&&&&&&&&&&&String&wlanacip2)&throws&Exception&{&&&&&&&&DefaultHttpClient&httpclient&=&new&DefaultHttpClient();&&&&&&&&String&a1="http://172.21.16.38:8080/bpss/jsp/do_login.jsp";&&&&&&&&try&{&&&&&&&&&&&&HttpGet&httpget&=&new&HttpGet(a1);&&&&&&&&&&&&HttpResponse&response&=&httpclient.execute(httpget);&&&&&&&&&&&&HttpEntity&entity&=&response.getEntity();&&&&&&&&&&&&System.out.println("Login&form&get:&"&+&response.getStatusLine());&&&&&&&&&&&&EntityUtils.consume(entity);&&&&&&&&&&&&//这里需要生成并传递一个COOKIE过去&&&&&&&&&&&&System.out.println("Initial&set&of&cookies:");&&&&&&&&&&&&List&Cookie&&cookies&=&httpclient.getCookieStore().getCookies();&&&&&&&&&&&&if&(cookies.isEmpty())&{&&&&&&&&&&&&&&&&System.out.println("None");&&&&&&&&&&&&}&else&{&&&&&&&&&&&&&&&&for&(int&i&=&<span style="color: #;&i&&&cookies.size();&i++)&{&&&&&&&&&&&&&&&&&&&&System.out.println("-&"&+&cookies.get(i).toString());&&&&&&&&&&&&&&&&}&&&&&&&&&&&&}&&&&&&&&&&&&HttpPost&httppost&=&new&HttpPost(a1);&&&&&&&&&&&&List&NameValuePair&&nvps&=&new&ArrayList&NameValuePair&();&&&&&&&&&&&&nvps.add(new&BasicNameValuePair("local",&"zh_CN"));&&&&&&&&&&&&nvps.add(new&BasicNameValuePair("USER",&userName));&&&&&&&&&&&&nvps.add(new&BasicNameValuePair("PWD",&"<span style="color: #3456"));&&&&&&&&&&&&nvps.add(new&BasicNameValuePair("pwdtype",&"<span style="color: #"));&&&&&&&&&&&&nvps.add(new&BasicNameValuePair("actiontype",&"LOGIN"));&&&&&&&&&&&&nvps.add(new&BasicNameValuePair("logonsessid",&""));&&&&&&&&&&&&httppost.setEntity(new&UrlEncodedFormEntity(nvps,&HTTP.UTF_8));&&&&&&&&&&&&response&=&httpclient.execute(httppost);&&&&&&&&&&&&entity&=&response.getEntity();&&&&&&&&&&&&System.out.println("测试地址:&"&+&a1);&&&&&&&&&&&&System.out.println("Login&form&get:&"&+&response.getStatusLine());&&&&&&&&&&&&EntityUtils.consume(entity);&&&&&&&&&&&&&&&&&&&&&&&&//读出COOKIE信息&&&&&&&&&&&&System.out.println("Post&logon&cookies:");&&&&&&&&&&&&cookies&=&httpclient.getCookieStore().getCookies();&&&&&&&&&&&&if&(cookies.isEmpty())&{&&&&&&&&&&&&&&&&System.out.println("None");&&&&&&&&&&&&}&else&{&&&&&&&&&&&&&&&&for&(int&i&=&<span style="color: #;&i&&&cookies.size();&i++)&{&&&&&&&&&&&&&&&&&&&&System.out.println("-&"&+&cookies.get(i).toString());&&&&&&&&&&&&&&&&}&&&&&&&&&&&&}&&&&&&&&}&finally&{&&&&&&&&&&&&try&{&&&&&&&&&&&&&&&&httpclient.getConnectionManager().shutdown();//&总是关闭连接&&&&&&&&&&&&}&catch&(Exception&ignore)&{&&&&&&&&&&&&&&&&System.out.println(ignore.getMessage());&&&&&&&&&&&&}&&&&&&&&}&&&&}我用java模拟post提交表单,为什么密码一直不正确(或者是其他错误)?
我用java模拟post表单提交到我们学校的个人中心,结果一直不正确,我不知道是不是提交的url的问题还是其他(header或者form)的问题,高手们帮忙看看呀~下面给出我的代码及抓到的包:&br&学校的网页:&a href=&///?target=http%3A//portal./cas/login%3Fservice%3Dhttp%253A%252F%252Fportal.%252Fcas.jsp& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&欢迎登录&i class=&icon-external&&&/i&&/a&&br&这是抓到的包:&br&&img src=&/73ccea489dcaa55de1d7c42fec276261_b.png& data-rawwidth=&600& data-rawheight=&200& class=&origin_image zh-lightbox-thumb& width=&600& data-original=&/73ccea489dcaa55de1d7c42fec276261_r.png&&&img src=&/c30c5aa1acfb_b.png& data-rawwidth=&600& data-rawheight=&153& class=&origin_image zh-lightbox-thumb& width=&600& data-original=&/c30c5aa1acfb_r.png&&&br&下面是我的java代码:&br&&img src=&/fa4c94d7604_b.png& data-rawwidth=&1155& data-rawheight=&581& class=&origin_image zh-lightbox-thumb& width=&1155& data-original=&/fa4c94d7604_r.png&&&img src=&/d351cd5bb757fceb4d943d_b.png& data-rawwidth=&808& data-rawheight=&531& class=&origin_image zh-lightbox-thumb& width=&808& data-original=&/d351cd5bb757fceb4d943d_r.png&&&img src=&/f9baa769b86f9b89e4ddd7f465f50e89_b.png& data-rawwidth=&576& data-rawheight=&379& class=&origin_image zh-lightbox-thumb& width=&576& data-original=&/f9baa769b86f9b89e4ddd7f465f50e89_r.png&&&br&账号和密码都用xxxxxx代替了
理解一下。&br&最终的结果是这样的:&br&中间是一个302跳转,然后我提取了跳转之后的location:&br&&a href=&///?target=http%3A//portal./portal/media-type/html/role/guest/page/login%3Fmessage%3DJLOGINUSER_PASSWORDNOTVALID& class=& external& target=&_blank& rel=&nofollow noreferrer&&&span class=&invisible&&http://&/span&&span class=&visible&&portal./port&/span&&span class=&invisible&&al/media-type/html/role/guest/page/login?message=JLOGINUSER_PASSWORDNOTVALID&/span&&span class=&ellipsis&&&/span&&i class=&icon-external&&&/i&&/a&&br&&br&&a href=&///?target=http%3A//portal./portal/media-type/html/role/guest/page/login%3Fmessage%3DJLOGINUSER_PASSWORDNOTVALID& class=& wrap external& target=&_blank& rel=&nofollow noreferrer&&PASSWORDNOTVALID&i class=&icon-external&&&/i&&/a& 密码不可用 我不知道为什么这样。高手们帮忙看看。&br&要是不行的话,我只能去学python自动填写表单提交页面了啊。
我用java模拟post表单提交到我们学校的个人中心,结果一直不正确,我不知道是不是提交的url的问题还是其他(header或者form)的问题,高手们帮忙看看呀~下面给出我的代码及抓到的包:学校的网页:这是抓到的包:下面是我的java代码:…
抓包看下密码是不是密文传输的
已有帐号?
无法登录?
社交帐号登录Java模拟表单post提交 HttpClient_小组_ThinkSAAS
Java模拟表单post提交 HttpClient
Java模拟表单post提交 HttpClient
import java.io.IOE
import java.io.UnsupportedEncodingE
import mons.httpclient.H
import mons.httpclient.HttpC
import mons.httpclient.HttpE
import mons.httpclient.HttpS
import mons.httpclient.NameValueP
import mons.httpclient.methods.PostM
public class SendPostMethod {
String methodPost(String url,NameValuePair[] data){
String response="";//要返回的response信息
HttpClient httpClient = new HttpClient();
PostMethod postMethod = new PostMethod(url);
// 将表单的值放入postMethod中
postMethod.setRequestBody(data);
// 执行postMethod
int statusCode = 0;
statusCode = httpClient.executeMethod(postMethod);
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
// HttpClient对于要求接受后继服务的请求,象POST和PUT等不能自动处理转发
// 301或者302
if (statusCode == HttpStatus.SC_MOVED_PERMANENTLY
|| statusCode == HttpStatus.SC_MOVED_TEMPORARILY) {
// 从头中取出转向的地址
Header locationHeader = postMethod.getResponseHeader("location");
String location =
if (locationHeader != null) {
location = locationHeader.getValue();
System.out.println("The page was redirected to:"+ location);
response= methodPost(location,data);//用跳转后的页面重新请求。
System.err.println("Location field value is null.");
System.out.println(postMethod.getStatusLine());
response= postMethod.getResponseBodyAsString();
} catch (IOException e) {
e.printStackTrace();
postMethod.releaseConnection();
public static void main(String[] args) throws UnsupportedEncodingException {
String url ="";
NameValuePair name=new NameValuePair("name","allen");
NameValuePair password=new NameValuePair("password","allen");
NameValuePair[] data = {name,password};
String response=new SendPostMethod().methodPost(url,data);
System.out.println("********"+response);
其中需要的jar包:
1、 commons-httpclient-3.1-rc1.zip
2、commons-codec-1.3.jar
3、commons-logging-api.jar
在tomcat5.5中的Tomcat 5.5bin目录下或者
PHP开发框架
开发工具/编程工具
服务器环境
ThinkSAAS商业授权:
ThinkSAAS为用户提供有偿个性定制开发服务
ThinkSAAS将为商业授权用户提供二次开发指导和技术支持
手机客户端
ThinkSAAS接收任何功能的Iphone(IOS)和Android手机的客户端定制开发服务
官方1群:【已满】
让ThinkSAAS更好,把建议拿来。&&&&java模拟post请求
java模拟post请求
java模拟客户端向服务器发送post请求
若举报审核通过,可奖励20下载分
被举报人:
举报的资源分:
请选择类型
资源无法下载
资源无法使用
标题与实际内容不符
含有危害国家安全内容
含有反动色情等内容
含广告内容
版权问题,侵犯个人或公司的版权
*详细原因:
VIP下载&&免积分60元/年(1200次)
您可能还需要
开发技术下载排行

我要回帖

更多关于 安卓java模拟器下载 的文章

 

随机推荐