见代码附件
编写方式1
public static void Posts() throws IOException{
// 创建 HTTP POST 请求
HttpPost httpPost = new HttpPost("http://www.cninfo.com.cn/new/disclosure");
// 设置请求头
httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded");
// 构建要发送的数据字符串,动态替换 pageNum 参数
String pageNum = "1"; // 假设要发送的 pageNum 值为 3
String postData = String.format("column=szse_gem_latest&pageNum=%s&pageSize=30&sortName=&sortType=&clusterFlag=true", pageNum);
// 设置实体为要发送的数据字符串
httpPost.setEntity(new StringEntity(postData));
// 创建 HttpClient 并发送请求
try