<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
HttpClient client = new HttpClient();
public String sendGetRequest(String url) throws IOException {
GetMethod getMethod = new GetMethod(url);
client.executeMethod(getMethod);
String response = getMethod.getResponseBodyAsString();
getMethod.releaseConnection();
return response;
}
public void processResponse(String response) {
JSONObject jsonObject = new JSONObject(response);
String name = jsonObject.getString("name");
int age = jsonObject.getInt("age");
System.out.println("Name: " + name);
System.out.println("Age: " + age);
}