Jump to content

Question

Recommended Posts

  • 0
Posted (edited)
       int votes = -1;
        try
        {
            URL url = new URL(Config.VOTES_SITE_TOPZONE_URL);
            URLConnection con = url.openConnection();
            con.setConnectTimeout(5000);
            con.setReadTimeout(5000);
            con.addRequestProperty("User-Agent", "L2TopZone");
            InputStream is = con.getInputStream();
            InputStreamReader isr = new InputStreamReader(is);
            BufferedReader in = new BufferedReader(isr);
            String inputLine;
            while ((inputLine = in.readLine()) != null)
            {
                if (inputLine.contains("Votes:"))
                {
                    votes = Integer.valueOf(inputLine.split("<br>")[1].replace("</div>", ""));
                    break;
                }
            }
            in.close();
            isr.close();
            is.close();
        }
        catch (Exception e)
        {
            _log.info("[AutoVoteReward] Server TOPZONE is offline or something is wrong in link");
        }
        return votes;

The link should be like:

http://l2topzone.com/totalvotes.php?id=9752

You get only the server ID.

http://l2topzone.com/lineage/server-info/9752/l2blacksails

Edited by 'Baggos'

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock