每次请求同一页面(币种设置为EUR)

时间:2019-05-04 09:19:57

标签: java httpurlconnection

我正在使用以下课程:

public class GetHtmlContent {

public static String GetHtml(){

    String content = null;
    HttpURLConnection connection = null;

    try {
        connection =  (HttpURLConnection) new URL("https://www.hrkgame.com/en/randomkeyshop/set_currency/?cur=EUR&next=/en/").openConnection();
        connection.setUseCaches(false);
        Scanner scanner = new Scanner(connection.getInputStream());
        scanner.useDelimiter("\\Z");
        content = scanner.next();
        scanner.close();
    }catch ( IOException e) {
        System.out.println("IOException caught! \n" + e);
    }finally {
        connection.disconnect();
    }
    return content;
}

但是,即使艰难地将货币设置为EUR,我几乎每次都会获得随机货币

我从页面顶部的菜单中获得了链接。

我什至尝试了以下网址: https://www.hrkgame.com/en/randomkeyshop/set_currency?cur=EUR

非常感谢您的协助。

0 个答案:

没有答案