Java JSoup error fetching URL
<p>I'm creating an application which will enable me to fetch values from a specific website to the console. The value is from a <code>&lt;span&gt;</code> element and I'm using <em>JSoup</em>.</p>

<p>My challenge has to do with this error:</p>

<blockquote>
  <p>Error fetching URL</p>
</blockquote>

<p>Here is my Java code:</p>

<pre><code>public class TestSl {
    public static void main(String[] args) throws IOException {
        Document doc = Jsoup.connect("https://stackoverflow.com/questions/11970938/java-html-parser-to-extract-specific-data").get();
        Elements spans = doc.select("span[class=hidden-text]");
        for (Element span: spans) {
            System.out.println(span.text());
        }
    }
}
</code></pre>

<p>And here is the error on Console:</p>

<blockquote>
  <p>Exception in thread "main" org.jsoup.HttpStatusException: HTTP error fetching URL. Status=403, URL=<a href="https://stackoverflow.com/questions/11970938/java-html-parser-to-extract-specific-data">Java Html parser to extract specific data?</a>
      at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:590)
      at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:540)
      at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:227)
      at org.jsoup.helper.HttpConnection.get(HttpConnection.java:216)
      at TestSl.main(TestSl.java:19)</p>
</blockquote>

<p>What am I doing wrong and how can I resolve it?</p>