i want to make an application which is based on a php page, sending to it parameters to obtain data from the remote db through the php page.
I will use jsons, but my question is:
assumed i use this code to send request:
URL url = new URL("http://www.francescorizzi.altervista.org/Main.php?Request=Login&UserName=mario&Password=lol");
URLConnection conn = url.openConnection();
// Get the response
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
while ((line = rd.readLine()) != null) {
System.out.println(line);
}
Should i recreate the url object, conn, and rd at each new request? or is there a more efficient way to do this?
Please note: I'm new to http handling through java.