title: Can't read in HTML content from valid URL
body: <p>I am trying out a simple program for reading the HTML content from a given URL. The URL I am trying in this case doesn't require any cookie/username/password, but still I am getting a <strong>io.IOException: Server returned HTTP response code: 403</strong> error. Can anyone tell me what am I doing wrong here? (I know there are similar question in SO, but they didn't help):</p>
  
  <pre><code>    import java.net.*;
  import java.io.*;
  import java.net.MalformedURLException;
  import java.io.IOException;
  public class urlcont {
  public static void main(String[] args) {
  try {
    URL u = new URL("http://www.amnesty.org/");
    URLConnection uc = u.openConnection();
    uc.addRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");
    uc.connect();
    InputStream in = uc.getInputStream();
    int b;
    File f = new File("C:\\Users\\kausta\\Desktop\\urlcont.txt");
    f.createNewFile();
    OutputStream s = new FileOutputStream(f);
    while ((b = in.read()) != -1) {
      s.write(b);
    }
  }
  catch (MalformedURLException e) {System.err.println(e);}
  catch (IOException e) {System.err.println(e);} 
  }
  }
  </code></pre>