java模拟发送request
来源:互联网 发布:上海淘宝托管 编辑:程序博客网 时间:2024/04/29 23:46
可以模拟发送数据,我首先想到的是 外挂 作弊 呵呵
- import java.io.BufferedOutputStream;
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.io.FileOutputStream;
- import java.io.IOException;
- import org.apache.commons.httpclient.*;
- import org.apache.commons.httpclient.methods.GetMethod;
- import org.apache.commons.httpclient.params.HttpMethodParams;
- public class GetSample {
- public static void main(String[] args) {
- // 构造HttpClient的实例
- HttpClient httpClient = new HttpClient();
- // 创建GET方法的实例
- GetMethod getMethod = new GetMethod("http://www.baidu.com");
- // 使用系统提供的默认的恢复策略
- getMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
- new DefaultHttpMethodRetryHandler());
- try {
- // 执行getMethod
- int statusCode = httpClient.executeMethod(getMethod);
- if (statusCode != HttpStatus.SC_OK) {
- System.err.println("Method failed: "
- + getMethod.getStatusLine());
- }
- // 读取内容
- byte[] responseBody = getMethod.getResponseBody();
- // 处理内容
- writeFile(responseBody);
- System.out.println(new String(responseBody));
- } catch (HttpException e) {
- System.out.println("Please check your provided http address!");
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- getMethod.releaseConnection();
- }
- }
- static void writeFile(byte[] bt) throws IOException {
- BufferedOutputStream bos = new BufferedOutputStream(
- new FileOutputStream(File.separator + "page.htm"));
- bos.write(bt, 0, bt.length);
- bos.flush();
- }
- }
- java模拟发送request
- Postman模拟Request Payload发送请求
- JAVA模拟发送HTTP请求
- Java 后台模拟发送 POST GET 请求
- JAVA模拟微信消息发送请求
- 使用JAVA模拟发送邮件到邮箱
- Java实现模拟发送POST、GET请求
- HttpClient发送Request请求
- C 发送http request
- PHP 发送request请求
- Java--Java模拟异步消息的发送与回调
- NodeJS模拟request请求
- JAVA BOT程序模拟人类用户填写表单 并 发送
- 使用java程序模拟页面发送http的post请求
- Java应用程序模拟向Servlet发送POST请求
- Java应用程序模拟向Servlet发送POST请求
- Java模拟发送键盘消息 shift组合键
- 使用java程序模拟页面发送http的post请求
- 省市联动二级菜单
- Eclipse中的CVS配置
- Eclipse快捷键
- Java 遍历 文件夹
- MultiByteToWideChar和WideCharToMultiByte用法
- java模拟发送request
- Flash ActionScript.——加载配置文件时出现乱码
- Java 连 MySql 小例
- Discuz 6.1.0 配置文件
- lua教程
- 论平台与系统开发
- 持续集成了吗?
- 离别
- 推荐一个 程序解密网站