title: java.io.IOException: Server returned HTTP response code: 403 for URL
body: <p>I want to open a link from url : "<a href="http://www.kohls.com/search.jsp?search=jacket&amp;submit-search=web-regular" rel="noreferrer">http://www.kohls.com/search.jsp?search=jacket&amp;submit-search=web-regular</a>", sometimes i get:</p>
  
  <blockquote>
    <p>java.io.IOException: Server returned HTTP response code: 403 for URL. But it's ok when open the url using browser. Below is part of my code:</p>
  </blockquote>
  
  <pre><code>URL url = new URL("http://www.kohls.com/search.jsp?search=jacket&amp;submit-search=web-regular");
  
  InputStream is = url.openConnection().getInputStream();
  </code></pre>
  
  <p><strong>error detail</strong>  </p>
  
  <blockquote>
    <p>Exception in thread "main" java.io.IOException: Server returned HTTP response code: 403 for URL: <a href="http://www.kohls.com/search.jsp?N=0&amp;search=jacket&amp;WS=96" rel="noreferrer">http://www.kohls.com/search.jsp?N=0&amp;search=jacket&amp;WS=96</a>
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1627)
        at Links.main(Links.java:41)</p>
  </blockquote>