In this example, we going to hit a URL and read its response
String urlString = "http://gd.geobytes.com/GetCityDetails";
URL url = new URL(urlString);
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream())); //or url.getContent();
String line;
while((line = reader.readLine()) != null) {
result.append(line);
}
reader.close();
JSONParser parser = new JSONParser();
JSONObject json = new JSONObject();
try {
json = (JSONObject) parser.parse(line.toString());
} catch (ParseException e1) {
e1.printStackTrace();
log.debug("Catch exeception in jason praser"+e1);
}
String geobytesremoteip = json.get("geobytesremoteip").toString();