Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/319.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
JAVA:通过代理响应的ip错误_Java_Url_Proxy_Ip_Response - Fatal编程技术网

JAVA:通过代理响应的ip错误

JAVA:通过代理响应的ip错误,java,url,proxy,ip,response,Java,Url,Proxy,Ip,Response,有此程序: public static void main(String[] args) { System.setProperty("http.proxyHost", "177.40.136.238"); System.setProperty("http.proxyPort", "8080"); // Next connection will be through proxy. try { URL oracle = new URL("http:/

有此程序:

public static void main(String[] args) {
    System.setProperty("http.proxyHost", "177.40.136.238");
    System.setProperty("http.proxyPort", "8080");

    // Next connection will be through proxy.
    try {
        URL oracle = new URL("http://ip.jsontest.com/");
        while (true) {
            URLConnection yc = oracle.openConnection();
            BufferedReader in = new BufferedReader(new InputStreamReader(
                    yc.getInputStream()));
            String inputLine;
            while ((inputLine = in.readLine()) != null)
                System.out.println(inputLine);
            in.close();
        }
    } catch (IOException e) {
        e.printStackTrace();
    }

    // Now, let's 'unset' the proxy.
    System.clearProperty("http.proxyHost");
}

当我在控制台中获得ip时,它不像设置代理的ip(它是我的本地站的ip)。我做错了什么

所以,问题在于公共代理巫婆不会隐藏您的请求信息。我们需要做的就是通过匿名代理发送请求

“在控制台中获取ip”是什么意思?当您在浏览器中访问该URL时,结果是什么?“在控制台中获取ip”是指我获取的响应类似于{“ip”:“my.local.ip.address”}与在浏览器中相同