Code to login not working
<p>could anyone help me with figuring out why this code isn't working? It's supposed to log into HTS, but it doesn't work. It's not giving me any error messages or anything, just no result at all. Any help would be appreciated.</p>

<p>Here's the code:</p>

<pre><code>import java.net.*;
import java.io.*;

public class Login {

private static URL URLObj;
private static URLConnection connect;

public static void main(String[] args) {
    try {
        URLObj = new URL("http://www.hackthissite.org/user/login");
        connect = URLObj.openConnection();
        connect.addRequestProperty("REFERER", "http://www.hackthissite.org");
        connect.setDoOutput(true);

    }
    catch (MalformedURLException ex) {
        System.out.println("The URL specified was unable to be parsed or uses an invalid protocol. Please try again.");
        System.exit(1);
    }
    catch (Exception ex) {
        System.out.println("An exception occurred. " + ex.getMessage());
        System.exit(1);
    }

    try {
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(connect.getOutputStream()));
        writer.write("username=BrandonHeat&amp;password=**********&amp;btn_submit=Login");
        writer.close();

        BufferedReader reader = new BufferedReader(new InputStreamReader(connect.getInputStream()));

        String lineRead = "";

        while ((lineRead = reader.readLine()) != null) {
            System.out.println(lineRead);
        }

        reader.close();
    }
    catch (Exception ex) {
        System.out.println("There was an error reading or writing to the URL: " + ex.getMessage());
    }

}
</code></pre>

<p>}</p>
