private static String sendHttpPost(String url,
			List<NameValuePair> parameters) {

		CloseableHttpClient client = HttpClients.createDefault();
		HttpPost post = new HttpPost(url);

		String output = "";
		String line = "";
		try {

			// sets parameters
			List<NameValuePair> nameValuePairs = parameters;
			post.setEntity(new UrlEncodedFormEntity(nameValuePairs));

			// executes post
			HttpResponse response = client.execute(post);

			// returns output as stream
			BufferedReader rd = new BufferedReader(new InputStreamReader(
					response.getEntity().getContent()));

			while ((line = rd.readLine()) != null) {
				output = output + line + "\n";
			}

		} catch (IOException e) {
			e.printStackTrace();
		}

		return output;
	}