public byte[] post(String url,byte[] bytes) throws Exception { HttpPost httpPost = new HttpPost(url); httpPost.setEntity(new ByteArrayEntity(bytes)); httpPost.setHeader("Content-type", "application/octet-stream;charset=UTF-8"); //这里是设置虚拟IP String remoteIp = (int) (Math.random() * 255 + 1)+"."+(int) (Math.random() * 255 + 1)+"."+(int) (Math.random() * 255 + 1)+"."+(int) (Math.random() * 255 + 1); httpPost.setHeader("X-Forwarded-For",remoteIp); CloseableHttpResponse httpResponse = HttpClients.createDefault().execute(httpPost); try { HttpEntity entityResponse = httpResponse.getEntity(); int responseCode = httpResponse.getStatusLine().getStatusCode(); int contentLength = (int) entityResponse.getContentLength(); // OutputStream out = new By
版权声明:本文为xpf094原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。