httpClient代理真是爽,你也能夠寫花刺了

ip這裏是:172.0.0.0:80ui

我用「:」分割來填的,我是向url發送byte數據包。url

有了這東西,你不怕了,設置了    setSocketTimeout超時時間後,返回狀態不是200的通通不要。拿到一堆免費ip就開始了個人全國各地刷用戶量的旅程!spa


public static int doPostByte(String url, byte[] bytes, String ip) {debug

        int statusCode = 0;ip

        try (CloseableHttpClient httpClient = HttpClients.createDefault()) {get

            HttpPost httpPost = new HttpPost(url);it

            String[] ips = ip.split(":");io


            HttpHost proxy = new HttpHost(ips[0], Integer.parseInt(ips[1]), "http");bug

            RequestConfig config = RequestConfig.custom().setProxy(proxy).setConnectTimeout(1000).setSocketTimeout(1000).build();im


            httpPost.setConfig(config);

            CloseableHttpResponse response;

            httpPost.setEntity(new ByteArrayEntity(bytes));

            response = httpClient.execute(httpPost);


            statusCode = response.getStatusLine().getStatusCode();

            HttpEntity entity = response.getEntity();

            EntityUtils.consume(entity);

            response.close();

        } catch (IOException e) {

//            log.debug(ExceptionUtils.getFullStackTrace(e));

        }

        return statusCode;

    }

相關文章
相關標籤/搜索