0 Members and 1 Guest are viewing this topic.
protected static int getTopZoneVotes(){int votes = -1;URL url = null;URLConnection con = null;InputStream is = null;InputStreamReader isr = null;BufferedReader in = null;try{url = new URL(Config.VOTE_LINK_TOPZONE);con = url.openConnection();con.addRequestProperty("User-Agent", "L2TopZone");is = con.getInputStream();isr = new InputStreamReader(is);in = new BufferedReader(isr);String inputLine;while ((inputLine = in.readLine()) != null){if (inputLine.contains("</span></small>")){votes = Integer.valueOf(inputLine.split(">")[9].replace("</span", ""));return votes;}}}catch (Exception e){e.printStackTrace();}return votes;}