How do I get my Java code to display results after connection?
===

I have javacode which connects to a php script I've written and posts to it. The php contacts an API for evaluation and returns the results in html format. 


The Java appears to work, but in eclipse the result is the html comes back in html form with tags and all, not "pretty" form.


I would like to get my results to either launch in a browser. I tried placing it in my xampp folder, but that did nothing, it just downloaded the java script upon clicking the file.


Any ideas on how I can accomplish this? I am open to changing the php code somehow to have it just return the variables and having Java create some form for the user to see. I'm just not so adept at Java right now. Ideas and examples are great! Thanks


    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.io.OutputStreamWriter;
    import java.net.URL;
    import java.net.URLConnection;
    import java.net.URLEncoder;
     
    public class Connect {
     
     
        public void POSTDATA() {
        }
        public static void main(String[] args) {
            try {
            // Construct data
            String data = URLEncoder.encode("ipaddress", "UTF-8") + "=" + URLEncoder.encode("98.36.2.53", "UTF-8");
            
     
            // Send data
            URL url = new URL("http://localhost/myfiles/WorkingVersion.php");
            URLConnection conn = url.openConnection();
            conn.setDoOutput(true);
            OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
            wr.write(data);
            wr.flush();
     
            // Get the response
            BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
            String line;
            while ((line = rd.readLine()) != null) {
                System.out.println(line);
         }
            wr.close();
            rd.close();
        } catch (Exception e) {
        }
        }
     
    }


