Addapt this method to yours
public int getHopzoneVotes()
{
int votes = -1;
try
{
final URL obj = new URL(Config.VOTES_SITE_HOPZONE_URL);
final HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.addRequestProperty("User-Agent", "L2Hopzone");
con.setConnectTimeout(5000);
final int responseCode = con.getResponseCode();
if (responseCode == 200)
{
try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())))
{
String inputLine;
while ((inputLine = in.readLine()) != null)
{
if (inputLine.contains("<li><span class=\"rank anonymous tooltip\" title"))
{
votes = Integer.valueOf(inputLine.split(">")[2].replace("</span", ""));
break;
}
}
}
}
}
catch (Exception e)
{
announce("HOPZONE is offline. We will check reward as it will be online again.");
}
return votes;
}