public static int getFrequency(){
		Bukkit.getLogger().info("<Minetrends> Authenticating with Minetrends...");
		URL url = null;
		HttpURLConnection conn = null;
		int responseInt = 0;
		
		String urlParameters = "key=" + Minetrends.publicKey;
		  try {
			  url = new URL(Minetrends.hostname + "/api/getfrequency");
			  
		  } catch (Exception ex){
			  ex.printStackTrace();
		  }
		
		try {
			conn = (HttpURLConnection) url.openConnection();
		try {
			conn.setRequestMethod("POST"); //use post method
			conn.setDoOutput(true); //we will send stuff
			conn.setDoInput(true); //we want feedback
			conn.setUseCaches(false); //no caches
			conn.setConnectTimeout(4000); //set timeout
			conn.setInstanceFollowRedirects(true);
			conn.setAllowUserInteraction(false);
			conn.setRequestProperty("Content-Length", "" + Integer.toString(urlParameters.getBytes().length));
			conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
		}
			catch (ProtocolException e) {
			e.printStackTrace();
		}
		
		// Open a stream which can write to the URL
		DataOutputStream wr = new DataOutputStream(conn.getOutputStream());
		wr.writeBytes(urlParameters);
		wr.flush();
		wr.close();
		
		// Open a stream which can read the server response
		InputStream in = conn.getInputStream();
		try {
			BufferedReader rd  = new BufferedReader(new InputStreamReader(in));
			String response = rd.readLine();
			
			if (response != null){
				//Check if the response is a int.
				if (response.equalsIgnoreCase("invalid-key")){
					responseInt = -1;
				} else {
					try {
				        responseInt = Integer.parseInt(response); 
				    } catch(NumberFormatException e) { 
				    	responseInt = 0;
				    }
				}
			} else {
				responseInt = 0;
			}
		} catch (IOException e) {
			e.printStackTrace();
		} finally { //in this case, we are ensured to close the input stream
			if (in != null)
			in.close();
		}
		} catch (IOException e) {
		}finally {  //in this case, we are ensured to close the connection itself
			if (conn != null)
			conn.disconnect();
		}
		return responseInt;
		
	}