Sep 16

// Create query string

String queryString = "param1=" + 
   URLEncoder.encode(param1Value, "UTF-8");
queryString += "&param2=" +
   URLEncoder.encode(param2Value, "UTF-8");
    
// Make connection

URL url = new URL("http://www.obiweb.com.au"+queryString);
URLConnection urlConnection = url.openConnection();
    
// Read the response

BufferedReader in = new BufferedReader(
   new InputStreamReader(urlConnection.getInputStream()));
String line = null;
while ((line = in.readLine()) != null)
{
   System.out.println(line);
}
in.close(); 

written by objects \\ tags: , , , ,

Sep 23

// Create query string

String queryString = "param1=" + 
   URLEncoder.encode(param1Value, "UTF-8");
queryString += "&param2=" +
   URLEncoder.encode(param2Value, "UTF-8");
    
// Make connection

URL url = new URL("http://www.objects.com.au/");
URLConnection urlConnection = url.openConnection();
urlConnection.setDoOutput(true);
OutputStreamWriter out = new OutputStreamWriter(
   urlConnection.getOutputStream());

// Write query string to request body

out.write(queryString);
out.flush();
    
// Read the response

BufferedReader in = new BufferedReader(
   new InputStreamReader(urlConnection.getInputStream()));
String line = null;
while ((line = in.readLine()) != null)
{
   System.out.println(line);
}
out.close();
in.close(); 

written by objects \\ tags: , , ,