Here you can find the source of sendGetRequest(String path, Map
public static boolean sendGetRequest(String path, Map<String, String> params, String enc) throws Exception
//package com.java2s; //License from project: Apache License import java.net.HttpURLConnection; import java.net.URL; import java.net.URLEncoder; import java.util.Map; public class Main { public static boolean sendGetRequest(String path, Map<String, String> params, String enc) throws Exception { StringBuilder sb = new StringBuilder(path); sb.append('?'); for (Map.Entry<String, String> entry : params.entrySet()) { sb.append(entry.getKey()).append('=').append(URLEncoder.encode(entry.getValue(), enc)).append('&'); }/* ww w . jav a2 s. c om*/ sb.deleteCharAt(sb.length() - 1); URL url = new URL(sb.toString()); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.setConnectTimeout(5 * 1000); if (conn.getResponseCode() == 200) { return true; } return false; } }