testbot1, extremely unreliable word tuberculosis, always feels good about himself, feels that he knows everything;
Gossip and go directly to the code:
public static void main(String[] args) throws IOException {
System.out.println("an interesting story begin...");
while(true){
System.out.println("Jonathan:");
Scanner scan = new Scanner(System.in);
String request= scan.nextLine();
String info = URLEncoder.encode(request, "utf-8");
String APIkey = "###########";
String getUrl = "###########"
+APIkey+"&info="+info;
URL url = new URL(getUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.connect();
InputStream is = conn.getInputStream();
InputStreamReader isr = new InputStreamReader(is, "utf-8");
BufferedReader br = new BufferedReader(isr);
String line = "";
StringBuffer sb = new StringBuffer();
while((line = br.readLine()) != null){
sb.append(line);
}
String sb2 = sb.substring(sb.lastIndexOf(":"));
System.out.println("testbot1"+sb2.toString());
}
// is.close();
// br.close();
// conn.disconnect();
}